-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
background.feature
80 lines (70 loc) · 2.5 KB
/
background.feature
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
Feature: Background
Background allows you to add some context to the scenarios in a
single feature. A Background is much like a scenario containing a
number of steps. The difference is when it is run. The background is
run before each of your scenarios but after any of your Before
Hooks.
Scenario: One scenario and a background
Given a file named "features/background.feature" with:
"""
Feature: a feature
Background:
Given a background step
Scenario: a scenario
When a scenario step
"""
When I run cucumber-js
Then it fails
And the scenario "a scenario" has the steps:
| IDENTIFIER |
| Given a background step |
| When a scenario step |
Scenario: Two scenarios and a background
Given a file named "features/background.feature" with:
"""
Feature: a feature
Background:
Given a background step
Scenario: a scenario
When a scenario step
Scenario: another scenario
When another scenario step
"""
When I run cucumber-js
Then it fails
And the scenario "a scenario" has the steps:
| IDENTIFIER |
| Given a background step |
| When a scenario step |
And the scenario "another scenario" has the steps:
| IDENTIFIER |
| Given a background step |
| When another scenario step |
Scenario: Two examples within a rule with a background, plus a feature-level background
Given a file named "features/background.feature" with:
"""
Feature: a feature
Background:
Given a feature-level background step
Rule: a rule
Background:
Given a rule-level background step
Example: first example
When an example step
Example: second example
When an example step
When another example step
"""
When I run cucumber-js
Then it fails
And the scenario "first example" has the steps:
| IDENTIFIER |
| Given a feature-level background step |
| Given a rule-level background step |
| When an example step |
And the scenario "second example" has the steps:
| IDENTIFIER |
| Given a feature-level background step |
| Given a rule-level background step |
| When an example step |
| When another example step |