diff --git a/src/it/test_exclusion/invoker.properties b/src/it/test_exclusion/invoker.properties new file mode 100644 index 00000000..3e51a5a6 --- /dev/null +++ b/src/it/test_exclusion/invoker.properties @@ -0,0 +1 @@ +invoker.goals=clean verify site -e -ntp \ No newline at end of file diff --git a/src/it/test_exclusion/pom.xml b/src/it/test_exclusion/pom.xml new file mode 100644 index 00000000..4817310d --- /dev/null +++ b/src/it/test_exclusion/pom.xml @@ -0,0 +1,50 @@ + + + + 4.0.0 + + + it.scoverage-maven-plugin + integration_tests_parent + 1.0-SNAPSHOT + ../integration_tests_parent/pom.xml + + + test_exclusion + 1.0-SNAPSHOT + jar + Test Scoverage exclusion + Test Scoverage exclusion + + + + 2.13 + 12 + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + net.alchim31.maven + scala-maven-plugin + + + org.scalatest + scalatest-maven-plugin + + + @project.groupId@ + @project.artifactId@ + + .*package02.*;.*package05 + .*Package03HelloService.*;.*Package03ByeService + + + + + diff --git a/src/it/test_exclusion/src/main/scala/org/package01/Package01HelloService.scala b/src/it/test_exclusion/src/main/scala/org/package01/Package01HelloService.scala new file mode 100644 index 00000000..55ada336 --- /dev/null +++ b/src/it/test_exclusion/src/main/scala/org/package01/Package01HelloService.scala @@ -0,0 +1,8 @@ +package org.package01 + +object Package01HelloService { + + // gonna be included in coverage report + def hello: String = "Hello from package01" + +} diff --git a/src/it/test_exclusion/src/main/scala/org/package02/nested02/package02nested02objects.scala b/src/it/test_exclusion/src/main/scala/org/package02/nested02/package02nested02objects.scala new file mode 100644 index 00000000..00f40ebe --- /dev/null +++ b/src/it/test_exclusion/src/main/scala/org/package02/nested02/package02nested02objects.scala @@ -0,0 +1,14 @@ +// gonna be excluded from coverage report by package exclusion +package org.package02.nested02 + +object ImGonnaBeExcludedCauseImInPackage02Nested02 { + + def hello: String = "Hello from package02.nested02" + +} + +object SameStoryBro { + + def hello: String = "Hello from package02.nested02 again" + +} diff --git a/src/it/test_exclusion/src/main/scala/org/package02/package02objects.scala b/src/it/test_exclusion/src/main/scala/org/package02/package02objects.scala new file mode 100644 index 00000000..fca9d0c8 --- /dev/null +++ b/src/it/test_exclusion/src/main/scala/org/package02/package02objects.scala @@ -0,0 +1,14 @@ +// gonna be excluded from coverage report by package exclusion +package org.package02 + +object ImGonnaBeExcludedCauseImInPackage02 { + + def hello: String = "Hello from package02" + +} + +object SameStoryBro { + + def hello: String = "Hello from package02 again" + +} diff --git a/src/it/test_exclusion/src/main/scala/org/package03/Package03ByeService.scala b/src/it/test_exclusion/src/main/scala/org/package03/Package03ByeService.scala new file mode 100644 index 00000000..56914ec8 --- /dev/null +++ b/src/it/test_exclusion/src/main/scala/org/package03/Package03ByeService.scala @@ -0,0 +1,8 @@ +package org.package03 + +object Package03ByeService { + + // gonna be excluded from coverage report by file exclusion + def bye: String = "Bye from package03" + +} diff --git a/src/it/test_exclusion/src/main/scala/org/package03/Package03HelloService1.scala b/src/it/test_exclusion/src/main/scala/org/package03/Package03HelloService1.scala new file mode 100644 index 00000000..2d05b244 --- /dev/null +++ b/src/it/test_exclusion/src/main/scala/org/package03/Package03HelloService1.scala @@ -0,0 +1,8 @@ +package org.package03 + +object Package03HelloService1 { + + // gonna be excluded from coverage report by file exclusion + def hello: String = "Hello from package03 service 1" + +} diff --git a/src/it/test_exclusion/src/main/scala/org/package03/Package03HelloService2.scala b/src/it/test_exclusion/src/main/scala/org/package03/Package03HelloService2.scala new file mode 100644 index 00000000..38c422b2 --- /dev/null +++ b/src/it/test_exclusion/src/main/scala/org/package03/Package03HelloService2.scala @@ -0,0 +1,8 @@ +package org.package03 + +object Package03HelloService2 { + + // gonna be excluded from coverage report by file exclusion + def hello: String = "Hello from package03 service 2" + +} diff --git a/src/it/test_exclusion/src/main/scala/org/package04/Package04HelloService.scala b/src/it/test_exclusion/src/main/scala/org/package04/Package04HelloService.scala new file mode 100644 index 00000000..8eb0fbb0 --- /dev/null +++ b/src/it/test_exclusion/src/main/scala/org/package04/Package04HelloService.scala @@ -0,0 +1,11 @@ +package org.package04 + +object Package04HelloService { + + // gonna be excluded from coverage report by code comments below + + // $COVERAGE-OFF$ + def hello: String = "Hello from package04" + // $COVERAGE-ON$ + +} diff --git a/src/it/test_exclusion/src/main/scala/org/package05/package05objects.scala b/src/it/test_exclusion/src/main/scala/org/package05/package05objects.scala new file mode 100644 index 00000000..7b5cca13 --- /dev/null +++ b/src/it/test_exclusion/src/main/scala/org/package05/package05objects.scala @@ -0,0 +1,14 @@ +// gonna be excluded from coverage report by package exclusion +package org.package05 + +object ImGonnaBeExcludedCauseImInPackage05 { + + def hello: String = "Hello from package05" + +} + +object SameStoryBro { + + def hello: String = "Hello from package05 again" + +} diff --git a/src/it/test_exclusion/src/test/scala/org/package01/Package01HelloServiceTest.scala b/src/it/test_exclusion/src/test/scala/org/package01/Package01HelloServiceTest.scala new file mode 100644 index 00000000..ebe11c6b --- /dev/null +++ b/src/it/test_exclusion/src/test/scala/org/package01/Package01HelloServiceTest.scala @@ -0,0 +1,12 @@ +package org.package01 + +import org.scalatest.wordspec.AnyWordSpec + +class Package01HelloServiceTest extends AnyWordSpec { + + "Package01HelloService" should { + "say hello" in { + assert(Package01HelloService.hello == "Hello from package01") + } + } +} diff --git a/src/it/test_exclusion/validate.groovy b/src/it/test_exclusion/validate.groovy new file mode 100644 index 00000000..ce78045d --- /dev/null +++ b/src/it/test_exclusion/validate.groovy @@ -0,0 +1,19 @@ +try { + + def logFile = new File(basedir, "build.log") + def lines = logFile.readLines() + assert lines.contains("[INFO] Statement coverage.: 100.00%") + assert lines.contains("[INFO] Branch coverage....: 100.00%") + + def scoverageFile = new File(basedir, "target/scoverage.xml") + assert scoverageFile.exists() + + def reportFile = new File(basedir, "target/site/scoverage/index.html") + assert reportFile.exists() + + return true + +} catch (Throwable e) { + e.printStackTrace() + return false +}