SpecFlowOSS / SpecFlow

#1 .NET BDD Framework. SpecFlow automates your testing & works with your existing code. Find Bugs before they happen. Behavior Driven Development helps developers, testers, and business representatives to get a better understanding of their collaboration
https://www.specflow.org/
Other
2.22k stars 752 forks source link

MSTest TestContext messages mixed up in the output #2615

Closed StevenDenman closed 2 years ago

StevenDenman commented 2 years ago

SpecFlow Version

3.9.74

Which test runner are you using?

MSTest

Test Runner Version Number

2.2.9

.NET Implementation

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

Command line – PLEASE SPECIFY THE FULL COMMAND LINE

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

No response

Issue Description

Since MSTest v2.2.9, when I am running the tests in parallel, the TestContext messages are getting jumbled.

E.g. in the TestOutput, I got the Given for all 8 scenarios under one test:

TestContext Messages:
Given the first number is 4&#xD;
Given the first number is 2&#xD;
Given the first number is 6&#xD;
Given the first number is 8&#xD;
Given the first number is 5&#xD;
Given the first number is 7&#xD;
Given the first number is 1&#xD;
Given the first number is 3&#xD;

Steps to Reproduce

Running the tests inside Visual Studio does not seem to have this issue.

Running the tests in Rider, dotnet cmd has this issue.

dotnet test TestContextIssues.dll -l:trx;LogFileName=TestResults.xml

Link to Repro Project

https://github.com/StevenDenman/TestContextIssues

SabotageAndi commented 2 years ago

Interesting, as they should fixed exactly this issue with 2.2.9 - https://github.com/microsoft/testfx/releases/tag/v2.2.9

StevenDenman commented 2 years ago

So it seems they have fixed it for the Console.WriteLine when running in Visual Studio, I am not convinced they did anything with TestContext.WriteLine.

Running with dotnet still has issues for both.

I have raised a ticket with them - https://github.com/microsoft/testfx/issues/1146 so I suppose we can close this one, if SpecFlow has issues when it is fixed then I will revisit.

Thanks!

github-actions[bot] commented 1 year ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.