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

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 … Read more

Differences between Line and Branch coverage

Line coverage measures how many statements you took (a statement is usually a line of code, not including comments, conditionals, etc). Branch coverages checks if you took the true and false branch for each conditional (if, while, for). You’ll have twice as many branches as conditionals. Why do you care? Consider the example: public int … Read more