Forum Discussion
aurelien-reeves
4 years agoStaff
Hi,
Did you had the opportunity to take a look here in the documentation? https://cucumber.io/docs/cucumber/state/
Caution, be careful when sharing state between scenarios. This is often consider bad practice, it can make your steps more tightly coupled and harder to reuse. It is always better to have stateless scenarios. Before / After hooks will add a little overhead on your test suite, but it keeps your tests stateless which is more sane and easier to maintain.
However, if you do need some data being shared, the World object is the one to use: https://github.com/cucumber/cucumber-js/blob/master/docs/support_files/world.md
Related Content
- 2 years ago
- 5 years ago