SpecFlow icon indicating copy to clipboard operation
SpecFlow copied to clipboard

Context Injection in Specflow failing in c# when parallel test are executed in xunit, but works in sequential run

Open gupta-nandini opened this issue 4 years ago • 1 comments

SpecFlow Version

3.8.14

Which test runner are you using?

xUnit

Test Runner Version Number

2.4.1

.NET Implementation

.NET 5.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

Command line – PLEASE SPECIFY THE FULL COMMAND LINE

SpecFlow Section in app.config or content of specflow.json

{
    "bindingCulture": {
        "name": "en-us"
    },
    "language": {
        "feature": "en-us"
    },
    "livingDocGenerator": {
        "enabled": true,
        "filePath": "{CurrentDirectory}\\TestResults\\Mobile-TestExecution.json"
    }
}

Issue Description

I'm using IObjectContainer to get help with ContextInjection in specflow. I've 2 features files to handle 2 flows. Most of the steps are common so they both call same StepDefinition constructor.

Detailed instructions here.

Steps to Reproduce

Create 2 separate feature files using same stepdefinition constructor. Then run the test in parallel, the contextinjection object will be confused due to parallel run.

Link to Repro Project

No response

gupta-nandini avatar Jun 16 '21 10:06 gupta-nandini

Please provide a repro project where we can see this issue. From what you describe this should work.

SabotageAndi avatar Jul 05 '21 09:07 SabotageAndi