# first run the tests with coverage, generating a snapshot
dotcover cover
--targetExecutable="nunit3-console.exe"
--targetArguments="..."
--output="coverage-results.snapshot"
# then, generate the JSON report
dotcover report --Source="results.snapshot" --Output="coverage-results.json" --ReportType="JSON"
# then, generate the HTML report (a nice way of examining results manually)
dotcover report --Source="results.snapshot" --Output="coverage-results.html" --ReportType="HTML"
# Read the JSON file (my runners are on windows, so I'm using powershell)
$coverageJson = (Get-Content "coverage-results.json" -Raw) | ConvertFrom-Json
# Print the top level coverage result
Write-Host "Statements: $($coverageJson.CoveragePercent)%"
Latest posts by Rajesh Kumar (see all)
- Best AI tools for Software Engineers - November 4, 2024
- Installing Jupyter: Get up and running on your computer - November 2, 2024
- An Introduction of SymOps by SymOps.com - October 30, 2024