Code Coverage Colors in VSTS

For all pre-Beta2 builds of VSTS, the colors for code coverage were as follows:

- Code that was touched was highlighted in green.
- Code that was not touched was highlighted in red.
- Code that was partially* touched was highlighted in blue.

The more green you have in code coverage the better. However, in Beta 2, the wonderful UI people at Microsoft decided to make some changes. Now, we get the following:

- Code that was touched is now highlighted in some type of light green sage color.
- Code that was not touched is now highlighted in some sort of light purple-ish color.
- Code that was partially* touched is now highlighted in a light blue or sky blue color. <-- that's not quite the color, but you get the drift

Here is a blog post from someone on the VSTS team as to maybe why the change was made. I don't know about you, but when I first ran some tests and saw those colors in my code coverage results, I thought maybe my display color was off. I promptly opened up my VSTS options and changed them back to the more appropriate standard colors of green, red, and blue**.

I really think the UI folks missed the boat on this one. Code coverage goes hand-in-hand with unit testing. Anyone practicing TDD knows the phrase Red-Green-Refactor, where Red means a test failed and Green means a test passed. It's the whole stoplight way of thinking: Green means Go, Red means Stop. NUnit introduced us to it and the integrated unit testing in VSTS does the same sort of thing. Code coverage should be looked at the same way, if anything to provide consistency with unit testing. Code that gets touched in a test should be highlighted in green and code that does not get touched should be highlighted in red.

The blog post I refer to above mentions something about peoples eyes shifting focus to the red because they assumed the code in green was good. That's not the point of code coverage at all. The point of code coverage is not to make sure the code is correct, just that is gets executed during the test. Otherwise, how can you be sure your code does what it's supposed to do if not all of your code is even being touched?

Not to mention that red is a dominant color and will always grab a persons eye before any other color. Why do you think babies react to red before any other color? Or why most signs on a strip mall are in red? Or why matadors use a red flag to attract the bulls?

* = things like a switch statement.

** To do this, go to Tools, Options, Environment, Fonts and Colors. Under the Display Items list, look for Coverage Not Touched Area, Coverage Partially Touched Area, and Coverage Touched Area. Then change the Item Background color for each of those as you see fit.

Print | posted on Monday, September 26, 2005 6:09 AM

Feedback

# re: Code Coverage Colors in VSTS

left by Jennifer at 9/27/2005 3:55 AM
My only thinking here is that some people are color blind, and most sources would tell you to avoid these colors in the UI.

# VSTS Code Coverage Customization

left by Steven Smith at 9/30/2005 2:58 PM
VSTS originally used intuitive colors for code that was covered, code that was not covered, and code...

# re: Code Coverage Colors in VSTS

left by Kevin Jones at 11/2/2005 2:58 AM
Except of course bulls are color blind :)
Comments have been closed on this topic.