vstest.console.exe not generating trx file, TestResults empty

5.7k views Asked by At

I am trying to run below command on my build server,

c:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe" 
"C:\UnitTest\MyTests.dll"
 /settings:"C:\UnitTest\output.runsettings" 
 /UseVsixExtensions:"true" 
 /InIsolation 
 /Logger:"trx"



<?xml version="1.0" encoding="UTF-8"?>
<RunSettings>
  <RunConfiguration>
    <ResultsDirectory>.\TestResults</ResultsDirectory>
  </RunConfiguration>
</RunSettings>

It generates TestResults folder which is empty but doesnt have any TRX files.

Update: Getting below warning from command line. However dont see that when I run command in my local machine. Am I missing something in my testproject?

Warning: No test is available in C:\UnitTest\MyTests.dll. Make sure that installed test discoverers & executors, platform & framework version settings are appropriate and try again.**

1

There are 1 answers

1
rajcool111 On BEST ANSWER

After some research found that I will need to pass the test adapter for visual studio, which makes the tests discover-able.

/TestAdapterPath:"packages\xunit.runner.visualstudio.0.99.2

Here's the complete command,

    c:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe" 
/TestAdapterPath:"packages\xunit.runner.visualstudio.0.99.2" "C:\UnitTest\MyTests.dll"
 /settings:"C:\UnitTest\output.runsettings" 
 /UseVsixExtensions:"true" 
 /InIsolation 
 /Logger:"trx"

There is a nuget package available for xunit visual studio test adapter "xunit.runner.visualstudio.0.99.2"