Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Seeing Code Coverage for a Single Class

I work on a relatively large project that has thousands of unit tests that takes a "significant" amount of time to run.

Sometime I would like to see the code coverage that a particular unit test gives. Currently I use Eclemma to get code coverage, but this only seems to be able to give me code coverage on the entire project.

Is there a way to get this reduced view?

like image 760
cgp Avatar asked Jan 30 '26 14:01

cgp


1 Answers

I believe the correct answer is not to use Clover but to do what @his has recommended. To run a single JUnit Tests in coverage mode simply right click it and select Context Menu > Coverage as > JUnit Test.

To see only the affected classes after the coverage has been recorded select the little triangle in the Coverage View and select "Hide unused types".

This will filter the view and shows only packages and projects that hold "touched" classes.

like image 180
KFleischer Avatar answered Feb 01 '26 05:02

KFleischer