1

Reasking my older question:

Java test coverage: who covers what?

Background: I look at sonar's coverage report for a class and want to know, which test contributes to the coverage of a specific line / branch, so that it easy to got to that test and add the test for the newly introduced if-branch.

Are there other (preferably free) alternatives to clover in the IDE? Perhaps even such that they can be included into sonar ?

Or maybe tricks to enhance, accumulate information with some scripting in emma-reports ?

Or even further, patch emma or cobertura to log the required info (instead of logging a "1" for counting, one could well log the names of class under test and the test, I assume)

Thanks!

Community
  • 1
  • 1
Bastl
  • 2,926
  • 5
  • 27
  • 48

1 Answers1

4

You should definitely give a try to JaCoCo. Its integration with Sonar allows to benefit from new features, for example :

Simon Brandhof
  • 5,137
  • 1
  • 21
  • 28
  • but this does not answer the original question: by *which test* is line xy covered. I do not see it in the screenshots you linked, also not on the jacoco documentation: http://www.eclemma.org/jacoco/trunk/coverage/org.jacoco.core/org.jacoco.core.internal.analysis/CounterImpl.java.html#L25 – Bastl Mar 11 '13 at 07:48
  • 1
    @Bastl: the 2nd link was incorrect, I updated it. Please note that this feature is available only in Sonar 3.5 - which is expected to be out today Monday March, 11th. – Fabrice - SonarSource Team Mar 11 '13 at 12:51