Bastl
Bastl

Reputation: 2996

Java test coverage: who covers what?

Is there a tool similar to emma, that reports which test covers a specific implementation ?

Upvotes: 6

Views: 2373

Answers (2)

qwertzguy
qwertzguy

Reputation: 17727

If you don't want to bother paying / setting up Cover, a much simpler way is:

  • remove / disable all breakpoints
  • put a breakpoint on the line that you which to know the tests covering it
  • re-run the tests in debug mode
  • look at the stacktrace to find the test calling it

This methods also allows you to see how many times a line is covered and all the tests calling it.

Upvotes: 0

Lauri
Lauri

Reputation: 1899

In case you want to see, which tests cover which line of code, you may use Clover that shows you:

  • how many times one line got covered
  • which tests covered line in question

To see what one can expect from Clover, here is a screenshot: Clover coverage report. Opened info about test that hit line #49

Upvotes: 6

Related Questions