Code coverage is published to https://sonarcloud.io/project/overview?id=Warewolf_DotNet_Framework from https://dev.azure.com/Warewolf/Warewolf/_build?definitionId=3.
Coverage is collected by vstest.console.exe using the /EnableCodeCoverage commandline switch. Coverage is also collected from the server under test using microsoft.codecoverage.console.exe.
All coverage snapshots are converted into xml for publishing to SonarQube using microsoft.codecoverage.console.exe.
Files that are involved with code coverage are:
- pipeline-with-coverage.yml – Snapshot publishing to Azure DevOps and to SonarCloud.
- TestRun.ps1 – Using the ‘-Coverage’ switch.
- StartAsService.ps1 – Using the ‘-Coverage’ switch.
Note, some coverage is incidental. Incidental coverage is coverage over lines of code that do not have an assert in the test for those lines. For example running any integration test shows the entire server startup as covered. We can increase the quality of the code coverage by reducing incidental coverage. Good quality unit tests provide the best code coverage.