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
SpecFlow Section in app.config or content of specflow.json
No response
Issue Description
TearDown method fails after final scenario is ran in a [BeforeFeature] and [AfterFeature] setup.
Step definitions have a single [BeforeScenario] init of Page Objects
-- Steps class inherits hook class to access driver.Value in steps
Works fine using [BeforeScenario] and [AfterScenario] and does the exact same using IWebDriver instead of ThreadLocal
Error
TearDown failed for test fixture ConsoleApp2.Features.TestingThingFeature
TearDown : System.NullReferenceException : Object reference not set to an instance of an object.
StackTrace: --TearDown
at ConsoleApp2.Misc.test.TearDown() in C:\Users\user\source\repos\ConsoleApp2\ConsoleApp2\Misc\test.cs:line 32
at InvokeStub_Action`1.Invoke(Object, Span`1)
at System.Reflection.MethodBaseInvoker.InvokeWithOneArg(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.FireEvents(HookType hookType)
at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.OnFeatureEnd()
at TechTalk.SpecFlow.TestRunner.OnFeatureEnd()
at ConsoleApp2.Features.TestingThingFeature.FeatureTearDown()
at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
Steps to Reproduce
Hook
[Binding]
internal class test
{
public static ThreadLocal<IWebDriver> driver = new ThreadLocal<IWebDriver>();
//public static IWebDriver driver;
[BeforeFeature]
public static void SetUp()
{
new DriverManager().SetUpDriver(new ChromeConfig());
driver.Value = new ChromeDriver();
}
[AfterFeature]
public static void TearDown()
{
driver.Value.Close();
driver.Value.Quit();
}
}
Feature File
Feature: TestingThing
@Thingy1
Scenario: Go to SS Fitness and click btn
Given I navigate to SS Fitness
And I wait for page load
When I click the thing button
Then I verify page changes properly
Scenario: Go to SS Fitness and click btnn1
Given I navigate to SS Fitness
And I wait for page load
When I click the thing button
Then I verify page changes properly
Link to Repro Project
No response
The text was updated successfully, but these errors were encountered:
SpecFlow Version
3.9.74
Which test runner are you using?
NUnit
Test Runner Version Number
4.0.1
.NET Implementation
.NET 6.0
Project Format of the SpecFlow project
Sdk-style project format
.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
TearDown method fails after final scenario is ran in a [BeforeFeature] and [AfterFeature] setup.
-- Steps class inherits hook class to access driver.Value in steps
Error
Steps to Reproduce
Hook
Feature File
Link to Repro Project
No response
The text was updated successfully, but these errors were encountered: