You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Classic project format using <PackageReference> tags
.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
No response
Issue Description
When I create class with [BeforeTestRun] and [AfterTestRun] where I register my api factory (which is WebApplicationFactory) then tests are failing when I run them without debugger. When I run tests from explorer by clicking Debug Tests then everything works fine. Below is the stack trace. I am using Specflow.xUnit in this case. When I simply changed NuGet to Specflow.NUnit then tests are running correctly both with and without debugger.
With xUnit it is also worth to mention, that with [BeforeFeature("featureName)] everything works fine also.
Steps to Reproduce
Create class, that has some properties that should be initialized in BeforeTestRun attribute.
Try to use this property in step definitions class when running tests with Specflow xUnit runner without debugger.
Similar message should appear:
TechTalk.SpecFlow.BindingException Error calling binding method 'Products.Tests.Acceptance:Products.Tests.Integration.Steps.CreateProductStepDefinitions.WhenICreateTheProductWithNameQuantityPriceDescription(String, Int32, Decimal, String)': Value cannot be null. (Parameter 'client')
SpecFlow Version
3.9.74
Which test runner are you using?
xUnit
Test Runner Version Number
3.9.74
.NET Implementation
.NET 6.0
Project Format of the SpecFlow project
Classic project format using
<PackageReference>
tags.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
No response
Issue Description
When I create class with
[BeforeTestRun]
and[AfterTestRun]
where I register my api factory (which isWebApplicationFactory
) then tests are failing when I run them without debugger. When I run tests from explorer by clickingDebug Tests
then everything works fine. Below is the stack trace. I am usingSpecflow.xUnit
in this case. When I simply changed NuGet toSpecflow.NUnit
then tests are running correctly both with and without debugger.With xUnit it is also worth to mention, that with
[BeforeFeature("featureName)]
everything works fine also.Steps to Reproduce
Create class, that has some properties that should be initialized in
BeforeTestRun
attribute.Try to use this property in step definitions class when running tests with Specflow xUnit runner without debugger.
Similar message should appear:
TechTalk.SpecFlow.BindingException Error calling binding method 'Products.Tests.Acceptance:Products.Tests.Integration.Steps.CreateProductStepDefinitions.WhenICreateTheProductWithNameQuantityPriceDescription(String, Int32, Decimal, String)': Value cannot be null. (Parameter 'client')
Link to Repro Project
https://github.com/Piotrreek/Advanced-Programming-Techniques/tree/main/Products/tests/Products.Tests.Acceptance
This is the code of my hooks class and part of step definition class:
The text was updated successfully, but these errors were encountered: