1
- Feature : Running scenarios in parallel
1
+ Feature : Running scenarios in parallel with custom assignment
2
2
3
3
Scenario : Bad parallel assignment helper uses 1 worker
4
4
Given a file named "features/step_definitions/cucumber_steps.js" with:
5
5
"""
6
6
const {Then, setParallelCanAssign} = require('@cucumber/cucumber')
7
- const assert = require('assert ')
7
+ const {expect} = require('chai ')
8
8
let value = 0;
9
9
setParallelCanAssign(() => false)
10
- Then(/^value is (\d+)$/, function(v) { assert(++value === v) })
10
+ Then(/^value is (\d+)$/, function(v, cb) {
11
+ expect(++value).to.eq(v)
12
+ setTimeout(cb, 150)
13
+ })
11
14
"""
12
15
And a file named "features/a.feature" with:
13
16
"""
14
- Feature: no processing
17
+ Feature: only one worker works
15
18
Scenario: someone must do work
16
19
Then value is 1
17
20
@@ -25,14 +28,17 @@ Feature: Running scenarios in parallel
25
28
Given a file named "features/step_definitions/cucumber_steps.js" with:
26
29
"""
27
30
const {Then, setParallelCanAssign} = require('@cucumber/cucumber')
28
- const assert = require('assert ')
31
+ const {expect} = require('chai ')
29
32
let value = 0;
30
33
setParallelCanAssign(() => true)
31
- Then(/^value is (\d+)$/, function(v) { assert(++value === v) })
34
+ Then(/^value is (\d+)$/, function(v, cb) {
35
+ expect(++value).to.eq(v)
36
+ setTimeout(cb, 150)
37
+ })
32
38
"""
33
39
And a file named "features/a.feature" with:
34
40
"""
35
- Feature: no processing
41
+ Feature: separate worker for each scenario
36
42
Scenario: a
37
43
Then value is 1
38
44
@@ -55,7 +61,7 @@ Feature: Running scenarios in parallel
55
61
"""
56
62
And a file named "features/a.feature" with:
57
63
"""
58
- Feature: slow
64
+ Feature: adheres to setParallelCanAssign handler
59
65
Scenario: a
60
66
Given scenario 1
61
67
0 commit comments