locked
How to run failed test cases again with mstest RRS feed

  • Question

  •  

    Hi

     

    I am running my test cases using MSTest and if some of the test cases fail i want  to rerun the failed ones again.

    Is there a way i can use the .trx file as input to MSTest and rerun the failed test cases?

    Is there any other way I can rerun failed ones using MSTest?

     

    Thanks
    Tuesday, January 22, 2008 10:21 AM

Answers

  • Hello,

     

    There is no way to rerun (failed) tests from a given TRX file in mstest. But you can do that if you open the TRX in Visual Studio IDE (just double click on the TRX file in Windows Explorer). A Test Results window will open and failed tests will be checked. Then you can click on the Run button (or debug button) to rerun checked tests.

     

    If you know failed test names that you need to re-run, there is a way to run specific tests from mstest: the switch /test:<test name>, note that you can use this switch more than 1 time on command line, if you want to specify different tests. By default that is partial test name and this can match more than one test, but if you want exact match, use the switch: /unique.

     

    Thanks,

    Michael Koltachev, Visual Studio Team Test

     

    Thursday, January 24, 2008 7:34 AM

All replies

  • Hello,

     

    There is no way to rerun (failed) tests from a given TRX file in mstest. But you can do that if you open the TRX in Visual Studio IDE (just double click on the TRX file in Windows Explorer). A Test Results window will open and failed tests will be checked. Then you can click on the Run button (or debug button) to rerun checked tests.

     

    If you know failed test names that you need to re-run, there is a way to run specific tests from mstest: the switch /test:<test name>, note that you can use this switch more than 1 time on command line, if you want to specify different tests. By default that is partial test name and this can match more than one test, but if you want exact match, use the switch: /unique.

     

    Thanks,

    Michael Koltachev, Visual Studio Team Test

     

    Thursday, January 24, 2008 7:34 AM
  •  

    I already know of this I but to automate the second run with failed tests I can't go through the Visual Studio IDE way.

    I guess the only viable alternative would be to read the .trx to get the failed test names and then use /test switch to run them all.

    Thursday, January 24, 2008 7:43 AM
  • Our lab uses only MSTest to run the tests. We would like the lab to be able to rerun the failed tests. Is there a way to read the .trx to get the failed test names and then create a testlist of the failed test which can be run again so we get another .trx file with real failed tests? If we just run one test at a time we will lose the result i suppose or have too many .trx file.

     

     


    SDET - Windows Presentation Foundation
    Friday, December 16, 2011 12:05 AM