EclEmma
by Mex on Jan.27, 2009, under Technology
In the developer community test driven development pasterns are becoming more and more mainstream. By what ever name you call your paradigm Extreme Programming, or Agile Development, it become quickly clear to anyone who tries test driven development how useful and important it can be to your project. It also soon becomes clear how important the correct tooling can be, or rather how frustrating it can be without the correct tools. EclEmma is a code coverage plug-in for Eclipse that helps you ensure that you are meeting your code coverage requirements in a way that integrates with your development cycle, instead of being an extra strapped on stage. It works with your existing JUnit tests and gives you details on exactly which methods, lines, and instructions are being covered by your tests. There are 3 ways to inspect the degree of code coverage your test are providing, the first is via the coverage view. The coverage view shows you your coverage as an expandable table allowing you to drill into which classes are least covered. The second way you can see how much code you have covered is done via code highlighting. After running your test suite through EclEmma the lines of your source code will be highlighted green for a line that has been executed, yellow for a line that has been partially executed, and red for one that hasn’t been touched. This mode is brilliant for writing tests as you can see what parts of the code your tests cover, in example 2 you can see it’s clear that the IOException block is never touched in the test. The third way of visualising the coverage is via what EclEmma calls decorators, this adds details of code coverage to the Package Explorer. This option is not enabled by default but instructions are available from EclEmma help pages. This view allows you to easy see as your developing the coverage of your classes, but if you are using a lot of other decorators such as SVNand Maven you might find it makes the Package Explorer very busy and hard to read.
:EclEmma, Emma, Test Driven Development
As you can see I have lots more tests to write, so I better get on with finishing them. If this post is useful for you, or you have any suggestions please leave a comment.
1 comment for this entry:




March 16th, 2009 on 6:55 pm
I found your blog on google and read a few of your other posts. I just added you to my delicious. Keep up the good work. Look forward to reading more from you in the future.