IntelliJ - exclude some classes (packages) from test coverage report

Xorty picture Xorty · Jan 28, 2015 · Viewed 18.2k times · Source

I am currently using Java with Play framework. I have JUnit tests and I am trying to measure coverage with IntelliJ coverage runner.

Play unfortunately generates some rubbish classes and IntelliJ includes them in the report. Is there a way of excluding certain patterns from coverage report?

Answer

MichalD picture MichalD · Apr 12, 2016

You can specify which classes will be added to coverage data by editing run configuration of the test (tests) being executed.

Click on "Edit Configurations" when you have selected your test, open Code coverage settings tab and inside "Packages and classes to record coverage data" you can narrow down the packages from production code included in recording of coverage.