none
VSTest.console.exe generates different testId than Visual Studio and MSTest

    General discussion

  • Where running tests with VSTest you get a different testId in your trx file than you do when running with MSTest.

    This is an issue because it means the trx files generated by VSTest cannot be uploaded to MTM, using the TCM command line.  This is because the MTM automation mapping calculates the testId the same way MSTest does.

     

    Note*

    VSTest calculates the ID “correctly” if a test settings file is used

     

    Useful repo info -

    Sample VSTest command line:

    "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe" C:\SampleDLL\quicktests.dll /Logger:trx

     

    Sample MSTest command line:

    "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\MSTest.exe"  /testcontainer:C:\SampleDLL\quicktests.dll /resultsfile:testResults.trx

     

    Sample MSTest command line, with test settings:

    "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe" C:\SampleDLL\quicktests.dll /Logger:trx  /Settings:C:\SampleDLL\TestSettings.testsettings

    Monday, February 01, 2016 10:08 PM

All replies

  • Hi Troy Walsh,

    >>VSTest calculates the ID “correctly” if a test settings file is used

    Could you please tell me where to find the ID you mentioned.

    I just did a test in my side using the command line you offered. And the result is same.

    After running the test. It generated three .trx files. I opened these three .trx files in my VS2015 and I found they are all same.

    I can't find any difference in these three .trx files.

    In addition, I also check the .trx file in MTM. And as far as I know, running test in MTM is same as running test using MSTEST.

    After running test in MTM. You will find the .trx file in Test->Analyze Test Runs:

    Best Regards,

    Lake Xiao

    Wednesday, February 03, 2016 6:24 AM
    Moderator
  • Produced a trx without testsettings:
    "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe" "C:\DLL\UnitTestProject1.dll" /Logger:trx

    Produced a trx with testsettings:
    "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe" "C:\DLL\UnitTestProject1.dll" /Logger:trx /Settings:"C:\DLL\TestSettings.testsettings"

    Diff of the 2 trx files with the testId highlighted:


    • Edited by Troy Walsh Wednesday, February 03, 2016 2:44 PM
    Wednesday, February 03, 2016 2:44 PM