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

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

getContext is missing from the environment of BeforeFeatureScope #1232

irinikp opened this issue Jul 15, 2019 · 3 comments

Comments

@irinikp
Copy link

irinikp 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
Copy link
Contributor

jakzal 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
Copy link
Author

irinikp commented Aug 6, 2019

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

@jakzal
Copy link
Contributor

jakzal 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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants