Skip to content

Commit bff902a

Browse files
committed
document parallel
1 parent 7d97591 commit bff902a

File tree

4 files changed

+34
-19
lines changed

4 files changed

+34
-19
lines changed

docs/cli.md

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -122,21 +122,7 @@ Note that the rerun file parser can only work with the default separator for now
122122

123123
## Parallel
124124

125-
You can run your scenarios in parallel with `--parallel <NUMBER_OF_WORKERS>`. Each worker is run in a separate Node process and receives the following env variables (as well as a copy of `process.env` from the coordinator process):
126-
127-
* `CUCUMBER_PARALLEL` - set to 'true'
128-
* `CUCUMBER_TOTAL_WORKERS` - set to the number of workers
129-
* `CUCUMBER_WORKER_ID` - ID for worker ('0', '1', '2', etc.)
130-
131-
### Timing
132-
133-
When using parallel mode, the last line of the summary output differentiates between real time elapsed during the test run and aggregate time spent actually running steps:
134-
135-
```
136-
73 scenarios (73 passed)
137-
512 steps (512 passed)
138-
0m51.627s (executing steps: 4m51.228s)
139-
```
125+
See [Parallel](./parallel.md).
140126

141127
## Profiles
142128

docs/parallel.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Parallel
2+
3+
Cucumber supports running scenarios in parallel. The main process becomes a "coordinator" and spins up several separate Node processes to be the "workers". You can enable this with the `--parallel <NUMBER_OF_WORKERS>` CLI option:
4+
5+
```shell
6+
$ cucumber-js --parallel 3
7+
```
8+
9+
The number you provide is the number of workers that will run scenarios in parallel.
10+
11+
Each worker receives the following env variables (as well as a copy of `process.env` from the coordinator process):
12+
13+
* `CUCUMBER_PARALLEL` - set to 'true'
14+
* `CUCUMBER_TOTAL_WORKERS` - set to the number of workers
15+
* `CUCUMBER_WORKER_ID` - ID for worker ('0', '1', '2', etc.)
16+
17+
### Timing
18+
19+
When using parallel mode, the last line of the summary output differentiates between real time elapsed during the test run and aggregate time spent actually running steps:
20+
21+
```
22+
73 scenarios (73 passed)
23+
512 steps (512 passed)
24+
0m51.627s (executing steps: 4m51.228s)
25+
```
26+
27+
### Hooks
28+
29+
When using parallel mode, any `BeforeAll` and `AfterAll` hooks you have defined will run _once per worker_.

docs/profiles.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,5 @@ $ cucumber-js --profile ci
3737

3838
Some notes about how Profiles work:
3939

40-
- The `--profile` CLI option is repeatable, so you can apply multiple profiles at once
41-
- You can still supply options directly on the command line when using profiles, they will be appended to whatever comes from profiles
40+
- The `--profile` CLI option is repeatable, so you can apply multiple profiles at once.
41+
- You can still supply options directly on the command line when using profiles, they will be appended to whatever comes from profiles.

docs/retry.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Retry
22

3-
If you have a flaky scenario (e.g. failing 10% of the time for some reason), you can use *Retry* to have Cucumber attempt it multiple times until either it passes or the maximum number of attempts is reached. You enable this via the `--retry` CLI option, like this:
3+
If you have a flaky scenario (e.g. failing 10% of the time for some reason), you can use *Retry* to have Cucumber attempt it multiple times until either it passes or the maximum number of attempts is reached. You enable this via the `--retry <MAXIMUM_RETRIES>` CLI option, like this:
44

55
```shell
66
$ cucumber-js --retry 1
@@ -19,7 +19,7 @@ Some notes on how Retry works:
1919

2020
## Targeting scenarios
2121

22-
Using the `--retry` option alone would mean every scenario would be allowed multiple attempts - this almost certainly isn't what you want, assuming you have a small set of flaky scenarios. To target just the relevant scenarios, you can provide a [tag expression](https://cucumber.io/docs/cucumber/api/#tag-expressions) via the `--retry-tag-filter` CLI option, like this:
22+
Using the `--retry` option alone would mean every scenario would be allowed multiple attempts - this almost certainly isn't what you want, assuming you have a small set of flaky scenarios. To target just the relevant scenarios, you can provide a [tag expression](https://cucumber.io/docs/cucumber/api/#tag-expressions) via the `--retry-tag-filter <TAG_EXPRESSION>` CLI option, like this:
2323

2424
```shell
2525
$ cucumber-js --retry 1 --retry-tag-filter @flaky

0 commit comments

Comments
 (0)