How do you structure your hooks in your project? #631
Unanswered
Speedydanzalez
asked this question in
Q&A
Replies: 1 comment 2 replies
-
I'm not sure I fully understand the situation, but if you have a driver that is initialized by Reqnroll using context injection, you can simply implement The other approach that comes to my mind is to tag only the one that does not need the hook and add a filter condition to the global hook:
|
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I've been using Reqnroll for a few months but never really dug into the hooks. I've watched a few videos and read the Reqnroll documentation but I don't see much in the way of how to structure them in a project and the high level approach to using them. Up until now I've been putting the before/after scenario hooks in the step def file and then just scope binding with the name of the feature, but I've seen that people have Hook folders with global hooks and then more business specific hooks perhaps.
Let's say I'm initialising a driver and tearing it down in each test, so then I create a global hook to handle this. I create 100 features that use this hook since it's global and will run for each test.
But now let's say I have a simple backend test that uses .NET to search for the existence of a file in a folder, this doesn't need a setup and teardown of a driver but the global hook will run for this test unnecessarily.
Okay, so now we use a tag or scope binding against the hook to tell it to run only for those specifics features. That means I now need to write 100 feature tag/scope bindings with that hook, just because that one backend test didn't require that hook.
Would like to get an idea about how people are structuring and approaching hooks in their projects. Any advice would be really appreciated. Cheers.
Beta Was this translation helpful? Give feedback.
All reactions