We have an ASP.Net application and UI tests written with xUnit. Test plans are in VSTS, and in some cases same xUnit test method is associated to multiple test cases.
An azure build pipeline executes these tests using VSTest. The problem is when multiple test cases are associated with a single method seems only one of them is executed. E.g. The test cases in below screen shot are associated to same method and only one is executed.
We tried both 'Test assemblies' & 'Test Plan' option in Vstest, but results are same.
As per below link, it is not possible in xUnit to run the same test method multiple times in the same test session.
Some solutions I can think of are,
Please suggest if there is any better solution to the problem.
Thanks in advance!
Test methods are not executed when associating same test method to multiple test cases in VSTest running XUnit tests
As we know:
By default, each test class is a unique test collection. Tests within the same test class will not run in parallel against each other.
So, the response we got from Azure Devops Developer Community forum and xunit is XUnit does not allow running one test multiple times in the same session.
I personally think that the two workrounds you proposed are correct. You can use one of the two methods to solve this problem. You are already on the right way.
Hope this helps.