If you’re using Azure DevOps for your CI/CD pipeline, you may be interested in our recent improvements to code coverage testing. Code coverage tests can help you identify areas of your code that are not tested, or not tested enough, and improve the quality of your automated tests and overall code quality.
With our recent updates, you can now view code coverage results in a default view for .coverage format, using the default vstest task to publish code coverage. Additionally, if you have enabled code coverage policy, you will see comments in the pull request indicating whether or not the policy has been met, including comments about missing test cases or test executables.
We are continuously collecting feedback to improve our automated testing capabilities, so you can expect more updates and improvements in the future. More details on the released features below:
Default view for ‘.coverage’ format:
Code coverage results generated using the ‘.coverage’ format can now be viewed directly in the web portal. Previously results for ‘.coverage’ files could not be viewed in the portal UI and users were provided with a link to download the test results which could be viewed offline in an editor of choice. However, this created a broken experience whereby developers were forced to go outside the boundaries of the product to view ‘.coverage’ test results and then come back for completing other tasks. This feature release also brings parity with test cases generated using other tasks which can already be viewed directly in the portal. Read more about them here: Publish Code Coverage Results v2 Task
If a PR(pull request) fails to meet the code coverage policy set by your organisation, it automatically gets rejected. However, going forward the comments section of the PR will now be kept open so that developers can give justification as to why their code could not meet the policy. This helps provide improved clarity to the managers and whole team in general when reviewing past PRs.