You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/parallel.md
+114-2Lines changed: 114 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,12 +26,124 @@ This command is similar to `run`, however, steps output can't be shown in worker
26
26
27
27
Each worker spins an instance of CodeceptJS, executes a group of tests, and sends back report to the main process.
28
28
29
-
By default the tests are assigned one by one to the available workers this may lead to multiple execution of `BeforeSuite()`. Use the option `--suites` to assigne the suites one by one to the workers.
29
+
By default, the tests are assigned one by one to the available workers this may lead to multiple execution of `BeforeSuite()`. Use the option `--suites` to assign the suites one by one to the workers.
30
30
31
31
```sh
32
32
npx codeceptjs run-workers --suites 2
33
33
```
34
34
35
+
## Test stats with Parallel Execution by Workers
36
+
37
+
```js
38
+
const { event } =require('codeceptjs');
39
+
40
+
module.exports=function() {
41
+
42
+
event.dispatcher.on(event.workers.result, function (result) {
CodeceptJS also exposes the env var `process.env.RUNS_WITH_WORKERS` when running tests with `run-workers` command so that you could handle the events better in your plugins/helpers
129
+
130
+
```js
131
+
const { event } =require('codeceptjs');
132
+
133
+
module.exports=function() {
134
+
// this event would trigger the `_publishResultsToTestrail` when running `run-workers` command
// when running `run` command, this env var is undefined
142
+
if (!process.env.RUNS_WITH_WORKERS) await_publishResultsToTestrail();
143
+
});
144
+
}
145
+
```
146
+
35
147
## Parallel Execution by Workers on Multiple Browsers
36
148
37
149
To run tests in parallel across multiple browsers, modify your `codecept.conf.js` file to configure multiple browsers on which you want to run your tests and your tests will run across multiple browsers.
Child workers can send nontest events to the main process. This is useful if you want to pass along information not related to the tests event cycles itself such as `event.test.success`.
351
+
Child workers can send non-test events to the main process. This is useful if you want to pass along information not related to the tests event cycles itself such as `event.test.success`.
0 commit comments