parallel-testing allows the execution of any test frameworks in parallel, dramatically reducing the execution time.
parallel-testing allows the execution of any test frameworks in parallel, dramatically reducing the execution time.
Install parallel-testing package
``js`
npm install parallel-testing --save-dev
Add parallel-testing command to package.json scripts
``
{
...,
scripts: {
...,
"e2e": "parallel-testing --threads=
},
....
}
[KEY_TEST_COMMAND]: '',
[KEY_TASK_PREFIX]: '',
[KEY_SPECS]: '',
[KEY_THREADS]: '',
[KEY_MAX_THREADS]: '',
[KEY_AFTER_ALL_COMMAND]: ''parallel-testing args options
| Option | Description |
|-------------------|---------------------------------------------------|
| --test-cmd | Command used to run tests.
Add @SPECS as a placeholder in the command; it will be replaced with a comma-separated list of specs.@INSTANCE
Add as a placeholder in the command; it will be replaced with a thread instance ID, useful for report directory names. |e2e//.spec.js
| --task-prefix | Prefix used for the logs. |
| --specs | Test specs pattren, e.g: . |,`.
| --specs-separator |Test spec files separator delimiter, e.g:
| --threads | Number of parallel threads (Optional). |
| --max-threads | Maximum number of parallel threads (Optional). |
| --after-all-cmd | Command that runs after all tests are done. |
----------
Running Cypress e2e tests parallel, please check Cypress Demo.
The demo covers how to generate HTML report with screenshots and videos.
| Type | Total | Threads |
|----------|-----------|-----------|
| Serial | 57.8171s | 1 |
| Parallel | 24.9825s | 5 |
Running Puppeteer e2e tests parallel, please check Puppeteer Demo.
The demo covers how to generate HTML report with screenshots.
| Type | Total | Threads |
|----------|-----------|-----------|
| Serial | 16.6492s | 1 |
| Parallel | 8.8565s | 5 |
NOTE: Tests for each framework are different; please don't use these numbers to compare between these testing frameworks.
The demo statistics are generated using the Gnomon tool.