@@ -14,7 +14,7 @@ Scenario hooks run for every scenario.
1414` Before ` hooks run before the first step of each scenario.
1515
1616``` scala
17- Before { scenario : Scenario =>
17+ Before {
1818 // Do something before each scenario
1919}
2020```
@@ -24,7 +24,7 @@ Before { scenario : Scenario =>
2424` After ` hooks run after the last step of each scenario.
2525
2626``` scala
27- After { scenario : Scenario =>
27+ After {
2828 // Do something after each scenario
2929}
3030```
@@ -36,25 +36,36 @@ Step hooks invoked before and after a step.
3636### BeforeStep
3737
3838``` scala
39- BeforeStep { scenario : Scenario =>
39+ BeforeStep {
4040 // Do something before step
4141}
4242```
4343
4444### AfterStep
4545
4646``` scala
47- AfterStep { scenario : Scenario =>
47+ AfterStep {
4848 // Do something after step
4949}
5050```
5151
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+
5263## Conditional hooks
5364
5465Hooks can be conditionally selected for execution based on the tags of the scenario.
5566
5667``` scala
57- Before (" @browser and not @headless" ) { _ =>
68+ Before (" @browser and not @headless" ) {
5869 // Do something before each scenario with tag @browser but not @headless
5970}
6071```
@@ -64,11 +75,11 @@ Before("@browser and not @headless") { _ =>
6475You can define an order between multiple hooks.
6576
6677``` scala
67- Before (10 ) { _ =>
78+ Before (10 ) {
6879 // Do something before each scenario
6980}
7081
71- Before (20 ) { _ =>
82+ Before (20 ) {
7283 // Do something before each scenario
7384}
7485```
@@ -79,7 +90,7 @@ The **default order is 1000**.
7990
8091You mix up conditional and order hooks with following syntax:
8192``` scala
82- Before (" @browser and not @headless" , 10 ) { _ =>
93+ Before (" @browser and not @headless" , 10 ) {
8394 // Do something before each scenario
8495}
8596```
0 commit comments