So far the [BeforeTestRun] / [AfterTestRun] hooks were resolved from the "first" test run context. This is pretty arbitrary and misleading. They should have been resolved from the test run ("global") context.
This normally should not matter for single-threaded tests, but it seems that the way how SpecFlow v4 (and Reqnroll) invokes these hooks is different and they are not necessarily invoked from the same test thread that is used for test execution (this depends on the test execution framework probably, but with NUnit there seem to be a different thread), so anything that you register in [BeforeTestRun] to the injected container might not be visible for the step definitions or scenario hooks.
This PR changes this and resolves the [BeforeTestRun] / [AfterTestRun] hooks from the test run ("global") context. This means that some services that were available so far for these hooks are not available anymore (e.g. "IReqnrollOutputHelper"), let's see the impact of this.
Types of changes
[x] Bug fix (non-breaking change which fixes an issue).
[ ] New feature (non-breaking change which adds functionality).
[x] Breaking change (fix or feature that would cause existing functionality to not work as expected).
[ ] Performance improvement
[ ] Refactoring (so no functional change)
[ ] Other (docs, build config, etc)
Checklist:
[x] I've added tests for my code. (most of the time mandatory)
[x] I have added an entry to the changelog. (mandatory)
[x] My change requires a change to the documentation.
Fixing #58.
So far the
[BeforeTestRun]
/[AfterTestRun]
hooks were resolved from the "first" test run context. This is pretty arbitrary and misleading. They should have been resolved from the test run ("global") context.This normally should not matter for single-threaded tests, but it seems that the way how SpecFlow v4 (and Reqnroll) invokes these hooks is different and they are not necessarily invoked from the same test thread that is used for test execution (this depends on the test execution framework probably, but with NUnit there seem to be a different thread), so anything that you register in
[BeforeTestRun]
to the injected container might not be visible for the step definitions or scenario hooks.This PR changes this and resolves the
[BeforeTestRun]
/[AfterTestRun]
hooks from the test run ("global") context. This means that some services that were available so far for these hooks are not available anymore (e.g. "IReqnrollOutputHelper"), let's see the impact of this.Types of changes
Checklist: