otr4j / otr4j-issues

1 stars 0 forks source link

Maven code coverage reports for unit tests (JaCoCo) #13

Closed cobratbq closed 4 years ago

cobratbq commented 9 years ago

I've created a branch where JaCoCo is included in Maven pom.xml. I'm not sure if this is the approach we like to take, so I'm putting it here as a suggestion. Please have a look and see for yourself.

If you run mvn verify it creates a report in target/site/jacoco/. Unfortunately this report is not integrated with the other reports generated with mvn site. There is also an alternative plugin for Cobertura code coverage, but the JaCoCo solution seems to be more active and more current. (Supports Java 8, for example.)

A sample report can be found at the JaCoCo homepage: http://www.eclemma.org/jacoco/trunk/coverage/index.html

Also keep in mind that unit tests run slower when JaCoCo instruments the classes before testing. Is this desirable?

languitar commented 9 years ago

Jacoco is definitely the way to go since cobertura is not maintained anymore. I have a working integration into the reporting features of maven in another project. You can try to adapt the solution from there: https://code.cor-lab.org/projects/rsb/repository/rsb-java/revisions/master/entry/pom.xml

cobratbq commented 9 years ago

Alright, so that's the clue. One can use the same plugin in both sections 'build' and 'reporting'. Thanks, fixed and created PR https://github.com/otr4j/otr4j/pull/34.

languitar commented 9 years ago

Isn't this solved?

cobratbq commented 9 years ago

Committed in https://github.com/otr4j/otr4j/commit/f598f6961be33de6dcfa44a72ee2c99191fe5312