user1340582
user1340582

Reputation: 19709

How does JaCoCo for integration tests in Sonar actually work, compared to Cobertura?

Cobertura works by first 1) instrumenting the source files to be traced, and 2) executing the unit tests and comparing those to the instrumented classes. This way we can calculate the code coverage.

However with JaCoCo for integration tests (Selenium) I have not seen this "instrumentation" phase in documentation. The JaCoCo Agent is just set to dynamically trace the source code covered "on the fly" when executing tests. How does JaCoCo know what source code to compare against, since the code has not been priorly instrumented as with Cobertura? Also, what if I want to exclude some source code?

Upvotes: 2

Views: 912

Answers (1)

Indeed, by definition Jacoco instruments all java bytecode but you can tune this behavior with help of the 'excludes'/'includes' Jacoco parameters, see http://www.eclemma.org/jacoco/trunk/doc/agent.html.

Upvotes: 3

Related Questions