That said.. I'm always trying to increase coverage. My code base is just shy of 20,000 lines of code. To increase coverage by %1, I have to add 200 lines of coverage. Uncovered lines are sprinkled throughout the codebase and rarely in blocks larger than 1-3 lines. Writing a unit test to cover 1-3 lines typically involves writing 5-10+ lines of unit test code. So at this point, a %1 increase in test coverage is a lot of work and is something to celebrate.
The html reports generated by cobertura are great, but I find that they don't point me directly to the class with the most untested lines of code. So using the xml report, I wrote a simple gant (groovy) target to generate a report which orders classes by lines of uncovered code.
It is a simple script that took me about 30 minutes to write, but should help me attack my uncovered code a little more efficiently.
This script is on github: http://gist.github.com/642533. clone url: git://gist.github.com/642533.git
Sample output:








Ben, this is awesome. A run of Sonar against the codebase should also yield some "hotspots" that have good ROI.
ReplyDeleteThanks... I've been hearing about it and need to check it out!
ReplyDelete