Vstest.console.exe works, but not with a good file name, CodeCoverage.exe does not give any results

I have the following setup:

set __vsTestConsoleExe=C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe set __codeCoverageExe=C:\Program Files (x86)\Microsoft Visual Studio 14.0\Team Tools\Dynamic Code Coverage Tools\CodeCoverage.exe set __testFile=My.UnitTests.dll REM Below I get a ".coverage" file with the correct coverage. But the file name is kinda-random "%__vsTestConsoleExe%" "%__testFile%" /InIsolation /EnableCodeCoverage PAUSE REM Below I get a big ole nothing "%__codeCoverageExe%" collect /output:DynamicCodeCoverage.coverage "%__vsTestConsoleExe%" "%__testFile%" /InIsolation /EnableCodeCoverage "%__codeCoverageExe%" analyze /output:DynamicCodeCoverage.coveragexml DynamicCodeCoverage.coverage 

when the following line is executed:

 "%__vsTestConsoleExe%" "%__testFile%" /InIsolation /EnableCodeCoverage 

I get a good .coverage file, but its generated file name looks like:

 MyUSERNAME_MYMACHINE 2016-03-24 16_03_20.coverage 

The lines after the PAUSE statement (in the first block of code) look like they should collect the cover (and note, I give it the same "% __ vsTestConsoleExe%" comamand ......., but I get nothing from this.

What am I doing wrong?

+7
visual-studio visual-studio-2015 code-coverage mstest
source share
1 answer

I was unable to start vstest.console.exe.

I managed to get a "predictable" file name and get the information in the .coverage file using MsTest.exe.

 set __msTestExe=C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\MSTest.exe set __codeCoverageExe=C:\Program Files (x86)\Microsoft Visual Studio 14.0\Team Tools\Dynamic Code Coverage Tools\CodeCoverage.exe REM the below calls will create the binary *.coverage files "%__codeCoverageExe%" collect /output:"D:\BuildStuff\TestResults\AAA_DynamicCodeCoverage.coverage" "%__msTestExe%" /testcontainer:"D:\BuildStuff\BuildResults\My.UnitTests.One.dll" /resultsfile:"D:\BuildStuff\TestResults\My.UnitTests.One.trx" "%__codeCoverageExe%" collect /output:"D:\BuildStuff\TestResults\BBB_DynamicCodeCoverage.coverage" "%__msTestExe%" /testcontainer:"D:\BuildStuff\BuildResults\My.UnitTests.Two.dll" /resultsfile:"D:\BuildStuff\TestResults\My.UnitTests.Two.trx" "%__codeCoverageExe%" collect /output:"D:\BuildStuff\TestResults\CCC_DynamicCodeCoverage.coverage" "%__msTestExe%" /testcontainer:"D:\BuildStuff\BuildResults\My.UnitTests.Three.dll" /resultsfile:"D:\BuildStuff\TestResults\My.UnitTests.Three.trx" 

You can also combine 3 UnitTests.dll in one call

 REM the below calls will create the binary *.coverage file "%__codeCoverageExe%" collect /output:"D:\BuildStuff\TestResults\ZZZ_DynamicCodeCoverage.coverage" "%__msTestExe%" /testcontainer:"D:\BuildStuff\BuildResults\My.UnitTests.One.dll" /testcontainer:"D:\BuildStuff\BuildResults\My.UnitTests.Two.dll" /testcontainer:"D:\BuildStuff\BuildResults\My.UnitTests.Three.dll" /resultsfile:"D:\BuildStuff\TestResults\My.UnitTests.AllOfThem.trx" 

ZZZ_DynamicCodeCoverage.coverage is called "predictably" and has actual values โ€‹โ€‹in the .coverage file.

I donโ€™t know why .soverage files created by CodeCoverage.exe .. using vstest.console.exe in the list of arguments ... do not work. :( Again, it doesnโ€™t work the same. "Creates a .coverage file, but opens it, it has no information in it. "

0
source share

All Articles