Is Visual Studio Code Coverage deprecated with vNext projects?

Because code coverage tools baked into Visual Studio ( vstest.console.exe

and codecoverage.exe

) analyze binary files, such as files .dll

, and .exe

whether these tools still work with projects vNext (because they do not generate the binaries)?

I am trying to run code coverage in a solution using the vNext class libraries, but the only information I have been able to generate is the xUnit files .dll

, not my projects.

+3


source to share


2 answers


Our team is capable of generating a code coverage file for vNext solutions using OpenCover. This requires a bit of overhead since parsing OpenCover by project is project dependent, so you need to write a script to cycle through projects in your solution, run OpenCover, and then merge the coverage files.

Here is an example of what we do in a script in case someone wants to replicate it:



We iterate over each project and call both the DNX engine and OpenCover to create coverage for that project.

foreach($projectFile in $projectFiles)
{
    $project=$projectFile.Directory.Name

    $buildCommands=$buildCommands+$projectFile.Directory.FullName
    $testPoject = //Path//To//Test//Projects
    if(Test-Path $testPoject)
    {
        _Verbose "$testPoject exists for $project"
        $testCommand = "$OpenCoverUtil -register:user ""-excludebyfile:*\*.gen.cs"" ""-target:$DnxPath\dnx.exe "" ""-targetargs: $testPoject\project.json test"" ""-output:$Outpath\CS\$project.coverage.xml"" -skipautoprops -returntargetcode -filter:""+[$project*]*"""
        _Verbose $testCommand
        $testCommands=$testCommands+$testCommand
    }
}

      

+2


source


In a completely new solution that includes

  • ASP.NET 5 Preview Template Blank Project
  • MS Unit Test Project

Test Run -> Code Coverage Analysis - All Tests



USED ​​successfully, but it only shows code coverage for the Unit Test project. Also, as you may have noticed, you cannot add a reference for your vNext project to your Unit Test project, and also that xUnit is the only currently supported project framework test .

I think it's safe to assume that since it stands today, yes, these tools "break" for vNext projects since they don't run away from the runner xunit.runner.dnx

.

Interestingly, the same documentation states that you can trigger tags xunit.runner.dnx

from a test run of VS, so it seems like this type of problem, at least on their radar.

0


source







All Articles