Open ccarmannt opened 1 year ago
This error results from attempting to resolve the FeatureContext and/or the ScenarioContext as parameters of the BeforeTestRun hook. Those objects aren't available at that time in the sequence of execution. BoDi (SpecFlow's object container) attempts to resolve those objects using it's default object construction mechanism but it is not sophisticated enough to do that properly.
Instead, use the other hook attributes, such as BeforeFeature or BeforeScenario, that are appropriate to your situation.
HTH
That's very helpful, thanks.
SpecFlow Version
3.9.74
Which test runner are you using?
NUnit
Test Runner Version Number
3.13.3
.NET Implementation
equal or greater .NET Framework 4.6.1
Project Format of the SpecFlow project
Classic project format using
packages.config
.feature.cs files are generated using
SpecFlow.Tools.MsBuild.Generation NuGet package
Test Execution Method
Visual Studio Test Explorer
SpecFlow Section in app.config or content of specflow.json
n/a
Issue Description
Received this error when attempting a test run:
Steps to Reproduce
Set up with 2 classes for test hooks.
1:
2:
If I remove the parameters from at least one of the two methods, this error does not occur.
Link to Repro Project
No response