Wednesday, June 24, 2015

How to customize color settings for Code Coverage Result in Visual Studio ?



This question came up after one of our previous post –Understanding Code Coverage – How to determine which portion of code is being tested in Visual Studio ?.  We discussed about different colors of code coverage area and how it looks like when the code is covered, not covered or partially covered.  For few, the colors were different than what we have seen over the other post,  so the question was, can we customize the code coverage colors ? Yes. We can do it.
Here is the default color for the different set of code coverage block.
image31 How to customize color settings for Code Coverage Result in Visual Studio ?
Default Coloring of Code Coverage
To change color, or customize the style, you need to open Options Dialog window, from Tools –>Options.  Then search for “Fonts and Colors” option in the right side tree explorer.  Once Fonts and Colors is selected, search for “Coverage… “ under Display Items. You will find following three Display items
  • Coverage Not Touched Area
  • Coverage Partially Touched Area
  • Coverage Touched Area
image41 How to customize color settings for Code Coverage Result in Visual Studio ?
Code Coverage Options
Now, you can change the default color, fonts and styles for the individual items.
image42 How to customize color settings for Code Coverage Result in Visual Studio ?
Code Coverage Settings Change
Here is one example of different set of code coverage colors.
image43 How to customize color settings for Code Coverage Result in Visual Studio ?
Customize Code Coverage Color

No comments:

Post a Comment