I get the impression that it's not. I have three integration tests that succeed when run individually, but when run in parallel, I get System.ArgumentException: An item with the same key has already been added.
I was sure hoping that ScenarioContext.Current
always referred to the correct scenario, but it seems it's getting confused. Has anyone successfully added thread safety to this class? Or is there another approach I should be using for sharing values among step files?
ScenarioContext.Curent source:
public static ScenarioContext Current
{
get
{
if (current == null)
{
Debug.WriteLine("Accessing NULL ScenarioContext");
}
return current;
}
internal set { current = value; }
}
As you can see, it is not threadsafe https://github.com/techtalk/SpecFlow/blob/master/Runtime/ScenarioContext.cs
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With