question

AnnyD-2855 avatar image
0 Votes"
AnnyD-2855 asked TianyuSun-MSFT commented

Rerun fail test case - MsTest

Hi Team

I need to rerun the fail test case automatically using mstest in my automation project (selenium /C#)

I have few solutions as below but i am not finding the exact one . If any one has already worked ,pls help me out on this.

sol1 :

using TrxExtractFAiledTests.Exe , i will list out the failed test case by passing the dll through this exe and execute it .

But here the issue is , the final report will contain only these rerun test case results as the latest report . But i need the report should contain all the test case results.


Sol2 :

I found the below link but the code is not available and this looks complex !
https://www.codeproject.com/Articles/883305/MSTest-Rerun-Failed-Tests-Through-MSTest-exe-Wrapp

Sol 3 :

https://social.msdn.microsoft.com/Forums/en-US/65f00a6e-b118-408a-92e3-abfd384673f5/rerun-failed-tests-again-on-mstest?forum=vsunittest

dotnet-csharpvs-testing
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @AnnyD-2855 , welcome to Microsoft Q&A forum. I haven’t tested the solution 2, but solution 3 looks like more related to run unit tests in parallel. I think maybe you can consider using solution 1 with some modifications, for example combining the test results by using log4net.

0 Votes 0 ·

1 Answer

AnnyD-2855 avatar image
0 Votes"
AnnyD-2855 answered TianyuSun-MSFT commented

@TianyuSun-MSFT Thank you . But solution 1 ,the issue is the latest report will have just the fail test cases which rerun .
How log4net will help here ? Can you pls elaborate little more

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @AnnyD-2855 , I double checked, and I think using log4net will also not work, as the TrxExtractFAiledTests.Exe only runs failed test case, the passed test case will not run again and the log4net has no chance to record the test results which were passed. And I’m afraid, I don’t find any alternative(tools) that can combine the passed test results and failed test results.

0 Votes 0 ·