A simple structure of testing tasks and tips for Drupal.
- Unit testing is a kind of test in which minor testable parts or units of an application, called units, are individually and independently tested for proper operation.
- Integration Testing has a focus on the interaction between components or systems. This kind of testing means we’re checking the interplay of the units and how they’re working together.
- End-To-End Testing, or E2E testing or UI testing, means that actual user interactions are simulated by the computer; in doing so, E2E testing should include as many functional areas and parts of the technology stack used in the application as possible (nightwatch, cypress, behat etc).
- Visual Testing is the process of checking the visible output of an application and comparing it to the expected results. Put another way, it helps find "visual bugs" in the appearance of a page or screen different from purely functional bugs.
- Static analysis is not precisely testing, but I think it’s essential to mention it here. You can imagine it working like a spelling correction: It debugs your code without running the program and detects code style issues. This simple measure can prevent many bugs.
- Functional testing
- Speed/performance testing (lighthouse score)
- JS testing with nightwatch, cypress etc
- Browser support testing
- A11y testing
- Stress testing (jmeter, artillery, k6 etc)
- Build docker image
- Update Gitpod workspace docker image (prebuild, if exists)
- Create a git release with Release.txt (eg on GitHub)
- Deploy on STAGE/PRODUCTION etc
- Generate a sanitized database backup from Production
- Get screenshots (eg for different devices and screen sizes)
- Send notifications
- Update testing results budges to README
- If you want to test class methods write "Unit tests".
- If you want to test Module APIs write "Kernel tests".
- If you want to test Functional (Web UI) without JS needs write "Browser tests".
- If you want to test Functional (Web UI) that involve JS write "Javascript tests", nightwatch tests, "Behat tests", cypress.io tests etc.
- If you want to do stress tests use jmeter, artillery, k6 etc.
What to test for a Drupal project:
- dev* and *_ui modules are disabled on Production
- A user of Role X can submit a node form of a bundle
- A user of Role X can view a node of a bundle
- New site can be installed from configuration and/or demo content
- REST/JSON API (CRUD operations)
- REST/JSON API (get Nodes single, list, filtering, pager)
- REST/JSON API (get Views)
- REST/JSON API (get Blocks)
- REST/JSON API (get Configuration values)
- REST/JSON API (get Settings variables)
- REST/JSON API (stress test)
- REST/JSON API (security test)
- REST/JSON API (Permissions)
- Functionality (eg module API, test functions)
- Permissions (eg a Drupal user can access a page)
- Integration (eg PHP versions, dependencies versions, Drupal core versions)
- UI (Expected behavior on a Drupal page)
- Code validation according to standards
- Entity fields machine name patterns
- Broken JS functionality
- CKEditor buttons exist
- System: can create a new release/tag
- System: take a Prod database backup
- System: sanitize database
- System: rollback site to a snapshot
- drupal_rector & upgrade_status report
- View a node (for each bundle)
- Edit a node (for each bundle)
- View a list (views)
- User login works
- Webform submissions work
- Search works
- Cron task works
- SMTP and mail system works
- There are no JS errors on console