parallel-testing allows the execution of any test frameworks in parallel, dramatically reducing the execution time.
Install parallel-testing package
npm install parallel-testing --save-dev
Add parallel-testing command to package.json scripts
{
...,
scripts: {
...,
"e2e": "parallel-testing --threads=<NUMBER> --test-cmd='<STRING>' --task-prefix='<STRING>' --specs='<STRING>' --specs-separator='<STRING>' --after-all-cmd='<STRING>'",
},
....
}
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. |
|
Add @INSTANCE as a placeholder in the command; it will be replaced with a thread instance ID, useful for report directory names. |
|
--task-prefix | Prefix used for the logs. |
--specs | Test specs pattren, e.g: e2e/**/**.spec.js . |
--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.