Visualizing the code coverage results from Azure Pipelines in Visual Studio
In a previous post, I explained how to compute code coverage for a .NET Core project with Azure DevOps and Coverlet. In this post, the code coverage visualization could be done directly in Azure DevOps. As a developer, you want to see these results directly into the IDE.
Download the code coverage file from the build artifacts
Open the file in Visual Studio
In the "Code Coverage Results" tool window, find the method you want and double-click on it to open the file in the editor with the coverage highlight
Be sure to click on the "Show Code Coverage Coloring" button in the tool window. Visual Studio highlights the lines with 3 different colors:
- Green: block is covered
- Orange: block is partially covered
- Red: block is not covered
You can now quickly view where you can improve your coverage!
This post is part of the series 'Visual Studio Tips and Tricks'. Be sure to check out the rest of the blog posts of the series!
- View and edit the Tab Order of Windows Forms Controls
- Comparing files using Visual Studio
- Visual Studio Tips and tricks: Clipboard history
- Visual Studio Tips and tricks: Open recently closed files
- Visual Studio Tips and tricks: Multi-line and multi-cursor editing
- Visual Studio Tips and tricks: Extend/Reduce selection
- Visual Studio Tips and tricks: Undock/Re-dock a tool window
- Visual Studio Tips and tricks: Regex editing
- Visual Studio Tips and tricks: Find the current opened file in the solution explorer
- Visual Studio Tips and tricks: Default startup project
- Visual Studio Tips and tricks: Open the documentation of a symbol
- Visual Studio Tips and tricks: Paste as JSON
- Visual Studio Tips and tricks: Add project reference using drag & drop
- Visualizing the code coverage results from Azure Pipelines in Visual Studio (this post)
- Debugging a .NET assembly without the source code with Visual Studio
- Visual Studio Tips and tricks: Subword navigation
Do you have a question or a suggestion about this post? Contact me!