Difference of excluding for scoverageCompile, scoverageTest

530 views Asked by At

Depending on the config (scoverageCompile Vs. scoverageTest) the exclusion of classes happens in scoverage the code coverage varies quite significant.

How does the exclusion of files in combination with scoverageCompile / scoverageTest affect the code coverage?

1

There are 1 answers

2
sksamuel On

If you exclude classes in scoverageCompile then they will be ignored for the purposes of counting statements.

Let's say you had 2 class files A and B, each with 10 statements, so 20 statements in total. If class A has 10% coverage (1/10), and class B has 90% coverage (9/10), then overall your coverage is 50% (10/20). If you exclude class A, then your overall coverage is now 90%. If you exclude class B then its 10%.

Setting exclude classes in scoverageTest doesn't do anything, you are seeing the coverage as you would without any excludes. It makes sense for the key to be set on compile because you are excluding compile scope classes, you are not excluding tests.