-
Notifications
You must be signed in to change notification settings - Fork 46
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
Looking for clarification on Before/AfterFeature guarantees when running method-level test parallelism #345
Comments
Hope this helps a bit. 🙂 |
@DrEsteban I have been struggling quite much to describe the behavior in an understandable way in the docs, so feel free to send a PR for updating it based on the info you learn here. Probably others might have similar questions too. |
@gasparnagy How do you feel about me adding my example from 3. above in the docs? As a way to work around the behavior you're warning about, and to help explain what users can expect? (Giving an example of a work around might help users understand the problem itself.) Or would you prefer not to be that prescriptive in the official docs? |
Hmmm thinking about it again, perhaps it's not the right example. Because it comes with the caveats @obligaron very smartly pointed out, e.g. IDisposable considerations. I think I see what you mean 😄 It's a topic that's very hard to describe succinctly! Especially for junior .NET developers. I can see now why you decided to just recommend against it, otherwise the docs could get quite lengthy calling out all the edge cases and caveats 😆 |
I took a stab at it! #364 |
Related Documentation Page
https://docs.reqnroll.net/latest/execution/parallel-execution.html
Type of the problem
Missing information
Problem Description
The Parallel Execution page says:
Despite this well-reasoned warning, I still have a desire to use
[BeforeFeature]
and[AfterFeature]
in my test project 😄I just want to clarify: As long as I'm not expecting singleton-like behavior for each Feature and FeatureContext, am I guaranteed that every scenario will have the
[BeforeFeature]
and[AfterFeature]
hooks called as expected? Including access to the dependencies registered in those methods?For example, would the following things be valid?
1. Consistent context objects per Feature-level DI container
☝🏻 I realize that multiple
ResourceTracker
s might be created for the same Feature, due to the parallelization, but will it at least remain a consistent reference for the entire execution of the Scenario?2. Consistent dictionary values per FeatureContext
Similar to the first example - since all
*Context
objects are also dictionaries, will anything set in in a[BeforeFeature]
remain consistent for the duration of a Scenario?☝🏻 I recognize this example doesn't make sense haha, but is it technically possible?
3. Manually ensured singleton behavior per-Feature
☝🏻 Would that effectively make dependencies behave as if parallelization was disabled or at the Feature level?
Thanks for this awesome project, and thanks in advance for your response!
Please let me know if this is better as a Discussion rather than Issue, but I figured it might be a good idea to update the documentation a bit to clarify what users should expect.
The text was updated successfully, but these errors were encountered: