Is there anyway we can exclude specific packages while running code coverage using IntelliJ IDEA as coverage runner? There is an option under Run/Debug Configurations > Coverage, that allows us to include classes/packages, but it would be very tedious to include about a few hundred packages to exclude just a few.
To exclude test code from the code coverage results and only include application code, add the ExcludeFromCodeCoverageAttribute attribute to your test class. To include assemblies that aren't part of your solution, obtain the . pdb files for these assemblies and copy them into the same folder as the assembly .
To disable code coverage highlighting In the IDEA IDE, on the Analyze menu, click Show Code Coverage Data, or use the Ctrl+Alt+F6 keyboard shortcut. In the Code Coverage Suites dialog, choose No coverage.
There is probably no a way to match the packages that you want to include with a few wildcards? If you want to exclude one package from five packages (a, b, c, d, and e), this is the only option that I have found so far (in the "Run/Debug Configurations" dialog):
com.stackoverflow.a.*
com.stackoverflow.b.*
com.stackoverflow.d.*
com.stackoverflow.e.*
This is rather clumsy indeed.
When I run with code coverage (with a different configuration), the following output is shown:
D:\Programs\Java\jdk1.8.0_72\bin\java [...]
---- IntelliJ IDEA coverage runner ----
sampling ...
include patterns:
com\.stackoverflow\.q35257485\..*
com\.stackoverflow\.q34245660\.AnimatedBoxman(\$.*)*
exclude patterns:
Process finished with exit code 0
The "exclude patterns:" line gives the impression that it should be possible to exclude packages and/or classes, but I see no way to do this (in the "Run/Debug Configurations" dialog).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With