@@ -14,7 +14,7 @@ Scenario hooks run for every scenario.
14
14
` Before ` hooks run before the first step of each scenario.
15
15
16
16
``` scala
17
- Before {
17
+ Before { scenario : Scenario =>
18
18
// Do something before each scenario
19
19
}
20
20
```
@@ -24,7 +24,7 @@ Before {
24
24
` After ` hooks run after the last step of each scenario.
25
25
26
26
``` scala
27
- After {
27
+ After { scenario : Scenario =>
28
28
// Do something after each scenario
29
29
}
30
30
```
@@ -36,36 +36,25 @@ Step hooks invoked before and after a step.
36
36
### BeforeStep
37
37
38
38
``` scala
39
- BeforeStep {
39
+ BeforeStep { scenario : Scenario =>
40
40
// Do something before step
41
41
}
42
42
```
43
43
44
44
### AfterStep
45
45
46
46
``` scala
47
- AfterStep {
47
+ AfterStep { scenario : Scenario =>
48
48
// Do something after step
49
49
}
50
50
```
51
51
52
- ## Scenario parameter
53
-
54
- The scenario is available as parameter in all hooks.
55
-
56
- You can use it like this:
57
- ``` scala
58
- Before { scenario : Scenario =>
59
- // Do something with the scenario
60
- }
61
- ```
62
-
63
52
## Conditional hooks
64
53
65
54
Hooks can be conditionally selected for execution based on the tags of the scenario.
66
55
67
56
``` scala
68
- Before (" @browser and not @headless" ) {
57
+ Before (" @browser and not @headless" ) { _ =>
69
58
// Do something before each scenario with tag @browser but not @headless
70
59
}
71
60
```
@@ -75,11 +64,11 @@ Before("@browser and not @headless") {
75
64
You can define an order between multiple hooks.
76
65
77
66
``` scala
78
- Before (10 ) {
67
+ Before (10 ) { _ =>
79
68
// Do something before each scenario
80
69
}
81
70
82
- Before (20 ) {
71
+ Before (20 ) { _ =>
83
72
// Do something before each scenario
84
73
}
85
74
```
@@ -90,7 +79,7 @@ The **default order is 1000**.
90
79
91
80
You mix up conditional and order hooks with following syntax:
92
81
``` scala
93
- Before (" @browser and not @headless" , 10 ) {
82
+ Before (" @browser and not @headless" , 10 ) { _ =>
94
83
// Do something before each scenario
95
84
}
96
85
```
0 commit comments