TestCaseID which covered the specific line in source code?

23 views
Skip to first unread message

sridh...@gmail.com

unread,
May 1, 2018, 8:35:10 PM5/1/18
to JaCoCo and EclEmma Users
Hi Team,

We have a need where we need to know which were the list of test cases that covered a specific lines in a given class. is it possible to track that kind of information in jacoco?

We want to get the list of test cases that covered a specific method in a given class so that, we will run only those test cases if that method is modified in future for regression.

Can you please provide the details?

Thanks,
Sridhar

Marc Hoffmann

unread,
May 2, 2018, 2:07:52 AM5/2/18
to jac...@googlegroups.com
Hi Sridhar,

JaCoCo does not support this out of the box.

Sonarqube used to provide a "per test coverage" view for JaCoCo:

https://docs.sonarqube.org/display/PLUG/Usage+of+JaCoCo+with+Java+Plugin

Basically what you need to do to implement such a feature on your own:

- Hook into your test framework (e.g. with a JUnit execution listener)
- Dump and reset exec data after every test
- Do coverage analysis for every test
- Combine the coverage data to see which test contributed to which line.

Cheers,
-marc
Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages