Sunday, October 16, 2005

Test Coverage with Coverlipse

I am usually creating software project reports with some of the tools coming with Maven and which are very nicely integrated into the project web sites that Maven can produce.

Yesterday I came across a similar tools that comes as Eclipse plugin: Coverclipse.

I installed Coverclipse on my eclipse 3.1 version at home, which I usually do first before I decide to use it at work. The plug-in can be installed with the Eclipse Software Update manager.

A first run on a rather small project seemed to end in an endless loop. I might be wrong but I had the feeling that something was wrong and tried to terminate it, but could not succeed. After restarting Eclipse I was more cautious and explicitly named the package I wanted to include and switched anything else to be excluded from the coverage test. It might be that Coverlispe just wanted to cover everything that is somehow referenced it the project. After setting the filters Coverlipse executed all my JUnit tests in a timely manner. After Coverlipse executs your JUnit tests, it marks in the Eclipse editor on the left bar all lines which are covered with a green check mark and all lines which are uncovered with a red exclamation point. This is very helpfull but one can look at this at a bit dominante. Luckily the Coverlipse Class View has a button that allows to clear all results which also makes the markers on the editor bar vanishing.

I usually do not write unit tests for getters and setters. Coverlispe marks those methods red, which means they are not covered by unit tests. While this is true and undeniable, I wish there would be some filter mechanism similar to the package in- and exclusion that allows to exclude getters and setters from the coverage reports.

All in all I think it is a very nice tool and I will add it to my Eclipse installation at work.

No comments: