Skip to content

Instantly share code, notes, and snippets.

@M-Yankov
Created September 4, 2016 18:25
Show Gist options
  • Save M-Yankov/875cc00e19598de9b159d584af85af31 to your computer and use it in GitHub Desktop.
Save M-Yankov/875cc00e19598de9b159d584af85af31 to your computer and use it in GitHub Desktop.
Steps to generate a test coverage results using VS integrated testing framework.

This instructions applies to upload your test coverage to coveralls.io

Using Coveleralls .NET package and Visual Studio 2015 Enterprise

  1. Create Unit test project. Click Analyze Code Coverage from main menu in Visual Studio.
  2. Check TestResults folder in root directory of your project. Find .coverage file.
  • (If you don't use VS 2015 Enterprice check:
    vstest.console.exe /inIsolation /Enablecodecoverage YourTestProject.dll and find the output .coverage file)
  1. Execute following command: "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Team Tools\Dynamic Code Coverage Tools\CodeCoverage.exe" analyze /output:coverage.coveragexml C:\PathToYourCoverage.coverage
    where you will replace C:\PathToYourCoverage.coverage with your real physical path.
    This will generate coverage.coveragexml.
  2. Then execute
    csmacnz.Coveralls.exe --dynamiccodecoverage -i coverage.coveragexml --repoToken <YourRepoTokenHere> -o cov.json --dryrun --useRelativePaths
    This will generate cov.json file with
    --dryrun means that the command will not upload data to coveralls.io. If you want to upload, just remove it. Don't forget to add your repoToken from coveralls.io

https://github.com/csMACnz/Coveralls.net-Samples

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment