microsoft / vstest-docs

Documentation for the Visual Studio Test Platform.
Other
214 stars 149 forks source link

Collect code coverage results to specific path #144

Open oscarrodar opened 6 years ago

oscarrodar commented 6 years ago

When I run "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe" "D:\BuildAgent\work\22d15c2ebd171441\MYAPP.Tests\bin\Release\MYAPPTests.dll" /collect:"Code Coverage" the file generated is thrown at a folder within the TestResults folder naming it every time in a different way.

image

I would like the file to be put in a specific folder, ie: TestResults/CoverageReport, with an specific name, ie: MYAPP.coverage.

Is there a way this can be done using the vstest.console.exe utility through the command line?

gremlm commented 5 years ago

In reality, it is a bug! https://github.com/Microsoft/vstest-docs/blob/master/docs/analyze.md#collect-coverage-with-command-line-runner specifies that “This will generate a .coverage file in the \TestResults directory.” But instead .coverage file is generated in random directory located in \TestResults directory, so this .coverage file is impossible to specify as argument for execution CodeCoverage analyze. We have tried to start vstest.console.exe under CodeCoverage, like the following CodeCoverage collect /output:.\TestOut\VisualStudio4.coverage /vstest.console.exe test1.dll test2.dll /ResultsDirectory:.\TestOut. This create VisualStudio4.coverage file in directory .\TestOut, but execution of the CodeCoverage analyze /output:.\TestOut\VisualStudio4.coverage.xml generate an empty output like

\<?xml version="1.0" encoding="UTF-8" ?> \ \