Tests
There is currently 2 automated tests available for :
- user application (index.php) : end to end, with Selenium IDE
- API (api.php) : functional with a Codeception script
Automated tests
End to end (user application)
The scope of the application and its features are basically covered; these tests are not yet very detailed but already allow to check the essential. It follows 3 dimensions, according to Strategy:
- criteria
- depth : thus far level 1. of âDepth of checks in orderâŠâ; doesnât go into too much depth due to lack of time/knowledge of the tool and because the feat will probably change a lot in the coming time
- scope : âMapâ
Prerequisites
- Selenium IDE browser extension installed
- fake data in the instance to test (to create manually) :
- users : an admin, an actor (the most important profiles)
- entities : dozen of events (of 2-3 categories), some venues and organizers (try to link these entities, like an Event in a Venue with some Organizers)
- in pages :
- home : 1st event is in a registered Venue, min. 2 events in category âFĂȘtesâ
- agenda : the Saturday of the 5th week of the current months has min 2 events
- mail sending parameters are complete in
env.php
and mails can be sent (really or using a mail catcher for development like FakeSMTP)
The tests
Suites available by user type (screen size used) :
- public (small)
- actor (large)
- admin (large) : avoid tests editing and deleting items on prod !
Tests have some name conventions :
- âvarsâ : could need some adaptations in values filled by user
- ârâ : data is added, edited or deleted; restoration could be needed after the test
Running the tests on an instance
- in your browser, launch Selenium IDE and open project
tests/ladecadanse.side
- disable website CSP and to detect PHP errors ensure
ENV
equals âdevâ (when Whoops error page appears, a test is garanteed to fail) - select a test in a suite
- enter the URL to test (local, prodâŠ)
- run all tests in suite
Edit
âŠ
Functional (API)
Prerequisites
The application API must be configured with its access credentials defined in app/env.php
(LADECADANSE_API_USER
and LADECADANSE_API_KEY
)
Setup
Copy tests/.env_model
to a new file tests/.env
and enter the values used by your tests (URL targeted and submitted credentials)
The tests
- authentication
- request parameters validation
- get events, with response :
- as JSON
- correct structure
- required values
Running the tests on an instance
composer test:api
Strategy
Criteria considered to build tests suites (their scope and depth)
- features
- priority according to importance and frequency of use of feature
- most frequent user actions scenarios
- variables
- environnement (dev, prodâŠ)
- user logged in/out
- screen size (desktop, mobile)
Depth of checks in order to meet the user expectations of user actions, by order of precision and complexity to test :
- links respond and in their content the basic data are displayed, according to user :
- selection by
- filtering
- entity type : event, lieuâŠ
- entity values : region, date
- format (html, json, rssâŠ)
- scope
- detail : collection or single item
- entity detail (values selection) : summary or detailed
- filtering
- intention : view, add/edit, delete, other (report, exportâŠ)
- selection by
- data displayed is relevant according to filter (events : date, category, etc.) and scope (as in the previous point)
- users are guided in expected way by handling their mistakes (error handling, particularly in forms)
- data is modified exactly according to user action on it
- special and unexpected cases are handled