Java code coverage in Hudson

Robert Munteanu picture Robert Munteanu · Sep 14, 2009 · Viewed 8.4k times · Source

I'm migrating a couple of projects from an ant build to a maven one. The build server is , and will remain, Hudson.

I've been having trouble recording code coverage in hudson with cobertura due to the tests run and recorded twice problem.

The project is multi-module and it would be nice, although not required, to have an aggregated output of the code coverage data.

All in all, the solution I'm looking for must:

  • run automated tests for all modules and record the results once;
  • display the individual module code coverage in Hudson;
  • be easily configured once for the whole project, not in every module.

The solution can be based on Cobertura, or Emma, or any other java code coverage tool.


Update: Running the tests with Emma still duplicates the results and there's no merge capability, so it's not really usable with multi-module builds.

Answer

victor hugo picture victor hugo · Oct 3, 2009

Sonar is a very cool tool that is easily integrated with Hudson, I really like its organization with multi-module projects. You should give it a try

alt text http://sonar.codehaus.org/wp-content/uploads/2009/08/dashboard.png