Monday, November 26, 2012


Test coverage in Java and Smalltalk

When working with Java I usually have several plugins that I preconfigure in Maven. One is the the very usefull Cobertura plugin - it calculates the percentage of code assessed by tests.

That way you usually write a component/classes and try to cover it with as many tests as possible. Or you write the tests first (XP-Style) and then implement code until they are green. Often you want to know if you need more tests and how good they test your code.

When running maven with the Cobertura plugin (in combination with the site plugin) you get a site report that shows the coverage ratio. You can then dive into the report down into the Java packages and classes and see which lines are covered (green) and which not (red). For instance for an if/else you will see if both decision ways are covered by tests, etc.

Here is a sample report from the Java world.

Now Pavel created something similar for the Smalltalk and Pharo world. Here is the report from the Pharo kernel - scroll down to see the colored results. The Java report is still a little bit better structured - but I like that quality tools are available in both worlds.

Comments: Post a Comment

<< Home

This page is powered by Blogger. Isn't yours?