Vstest: CodeCoverage with user defined filename and path for .coverage

Created on 13 Mar 2019  路  6Comments  路  Source: microsoft/vstest

Description

It's not possible to define a filename and path for the .coverage file.

Steps to reproduce

Make a CodeCoverage with /EnableCodeCoverage and try to define a path and a name for the .coverage file.

Expected behavior

A file with a user defined name in a user defined path

Actual behavior

A random filename in a random foldersystem.

Environment

Windows Server / Windows 10
Team Foundation Server 2018 Patch 3.2
VsTest 16.0.1

enhancement up-for-grabs

Most helpful comment

@singhsarab @ShreyasRmsft Any one working on this issue? Can I try?

All 6 comments

@singhsarab @ShreyasRmsft Any one working on this issue? Can I try?

@krishnaanaril Sure, feel free to give it a shot.

@CSmith1111 While going through the source code I found that it is possible to provide filename by adding <CoverageFileName>YourName.coverage</CoverageFileName>in the *.runsettings file.

@CSmith1111 While going through the source code I found that it is possible to provide filename by adding <CoverageFileName>YourName.coverage</CoverageFileName>in the *.runsettings file.

what if a runsettings file isn't used, is it possible to supply this at the command line? I mean, is it as simple as /p:CoverageFileName=output.coverage? I tried something just as a guess at the prompt and it didn't work as I am supposing here.

@jakubch1

All properties from *.runsettings can be specified through command line with [-- <RunSettings arguments>]

Examples:
vstest.console.exe *.dll /EnableCodeCoverage -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.CoverageFileName="my.coverage"

For .NET Core:
dotnet test --collect:"Code Coverage" -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.CoverageFileName="my.coverage"

More info:
https://github.com/microsoft/vstest-docs/blob/master/docs/configure.md#using-command-line

Was this page helpful?
0 / 5 - 0 ratings