Background
Sonar currently reports on the code coverage of unit tests only using the Emma code coverage tool. It is however
...
towards automating all manual tests and improve the efficiency of our test base.
Jacoco
Jacoco is a code coverage tool that uses a different approach from Emma in to obtain code coverage data. Basically,
...
to define inclusions and exclusions to restrict jacoco to mifos code.
Getting the tools
- Download jacoco
- Download sonar jacoco plugin
- Download sonar
- Insert the jacoco plugin in the $SONAR_HOME/extensions/plugin directory
Doing the business (getting coverage report - integration tests)
- Modify the pom.xml in $MIFOS_HOME/applicaton directory by adding the following line to maven-surefire-plugin configuration element
...
Code Block |
---|
mvn -Dsonar.jacoco.itReportPath="/home/kojo/jackpath/to/coverage/dump/jacoco.exec" sonar:sonar -Dsonar.dynamicAnalysis |
...
- Go to sonar web interface and click on 'configure widgets' to add IT coverage widget
Miscellaneous
Jacoco Ant tasks - There exist ant tasks in the jacoco distribution that can be used were using java agent creates problems.
Debugging - Code coverage dumps can be inspected by passing the dump file as an argument to ExecDump.java found in the examples folder in the jacoco distribution.
References
- [measuring code coverage for integration tests using sonar|http://www.sonarsource.org/measure-code-coverage-by-integration-tests-with-sonar/]
- [Java agent|http://download.oracle.com/javase/6/docs/api/java/lang/instrument/package-summary.html]
- [Jacoco|http://www.eclemma.org/jacoco]