Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

`getContext` is missing from the environment of `BeforeFeatureScope` #1232

Open
irinikp opened this issue Jul 15, 2019 · 3 comments

Comments

@irinikp
Copy link

commented Jul 15, 2019

Hello!
Although we can access getContext through a BeforeScenarioScope as described here, we can't through a BeforeFeatureScope. Wouldn't that be nice?

@jakzal

This comment has been minimized.

Copy link
Contributor

commented Aug 5, 2019

At the time BeforeFeatureScope is dispatched no context is initialised yet.

See http://docs.behat.org/en/v3.0/user_guide/context/hooks.html#feature-hooks

@irinikp

This comment has been minimized.

Copy link
Author

commented Aug 6, 2019

OK @jakzal thanks! Is there any way I could use the context once before running all scenarios then?

@jakzal

This comment has been minimized.

Copy link
Contributor

commented Aug 6, 2019

Is there any way I could use the context once before running all scenarios then?

  • instantiate it yourself (which should light a few warning lights in your head ;) ) - not recommended
  • run whatever you need to run in a pre-scenario hook. If you really only want to run it once, remember you've already run it and check the flag on subsequent runs.

What are you trying to do?

It's desired to start with a clean state before each scenario. Running something before all scenarios is undesired, even if possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.