Alan Page’s Post

View profile for Alan Page, graphic

Just Alan

Smart thoughts on code coverage.

Author is spot on. I did a lot of testing on servers. My joke/rule of thumb was that you got a free 30% code coverage just by starting the server. I remember one time reviewing a module that was presented to as 100% code coverage. Someone had written tests against the getters and setters on every field to close the final mile. My comment to the engineer showing me this was "So, essentially, you are testing the C# compiler." Meanwhile, when surveying test code for APIs that used the same 100% covered classes, not a single one of those tests ever passed in a class with those covered properties set to a value, which did have an effect on functionality in those components. I said to the engineer "I don't care about the get/set coverage, what I care about is that none of these APIs were ever tested with this field's value set to true." Coverage metrics motivate bad behavior.

To view or add a comment, sign in

Explore topics