Skip to content

Commit 06caf75

Browse files
authored
Merge pull request #243 from cucumber/fixdoc
docs: ✏️ Add a note about static hooks and objects
2 parents 184618b + a7f7510 commit 06caf75

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

docs/hooks.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ See the [reference documentation](https://docs.cucumber.io/docs/cucumber/api/#ho
99

1010
Static hooks run once before/after all scenarios.
1111

12+
**Note:** static hooks can only be defined inside `object`s (not classes).
13+
1214
### BeforeAll
1315

1416
`BeforeAll` hooks run once before all scenarios.

docs/usage.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ class MyStepDefinitions extends StepsForThis with StepsForThat {
4747

4848
You can also define glue code in **objects**.
4949

50-
It's **not recommended** though, because by definition objects are singleton and if your glue code is stateful you will probably have "state conflicts" between your scenarios.
50+
Be aware that by definition objects are singleton and if your glue code is stateful you will probably have "state conflicts"
51+
between your scenarios if you use shared variables from objects.
5152

5253
## Running Cucumber tests
5354

0 commit comments

Comments
 (0)