Skip to content

Commit 6d67993

Browse files
committed
Add aggregate and aggregateOnly tests
1 parent 12197a6 commit 6d67993

File tree

24 files changed

+450
-0
lines changed

24 files changed

+450
-0
lines changed
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
invoker.goals=clean verify site -e -ntp
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
5+
<parent>
6+
<groupId>it.scoverage-maven-plugin</groupId>
7+
<artifactId>test_aggregate</artifactId>
8+
<version>1.0-SNAPSHOT</version>
9+
<relativePath>../pom.xml</relativePath>
10+
</parent>
11+
12+
<modelVersion>4.0.0</modelVersion>
13+
<artifactId>module01</artifactId>
14+
<name>Test SCoverage Aggregation : Module 1</name>
15+
16+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package pkg01
2+
3+
class HelloService1
4+
{
5+
def hello =
6+
{
7+
"Hello from module 1"
8+
}
9+
10+
}
11+
12+
object HelloService1 extends HelloService1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package pkg01
2+
3+
import org.junit.Test;
4+
import org.junit.Assert.assertEquals
5+
6+
class HelloServiceTest
7+
{
8+
@Test
9+
def test1()
10+
{
11+
assertEquals("Hello from module 1", HelloService1.hello)
12+
}
13+
14+
}
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
5+
<parent>
6+
<groupId>it.scoverage-maven-plugin</groupId>
7+
<artifactId>test_aggregate</artifactId>
8+
<version>1.0-SNAPSHOT</version>
9+
<relativePath>../pom.xml</relativePath>
10+
</parent>
11+
12+
<modelVersion>4.0.0</modelVersion>
13+
<artifactId>module02</artifactId>
14+
<name>Test SCoverage Aggregation : Module 2</name>
15+
16+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package pkg02
2+
3+
class HelloService2
4+
{
5+
def hello =
6+
{
7+
"Hello from module 2"
8+
}
9+
10+
}
11+
12+
object HelloService2 extends HelloService2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package pkg02
2+
3+
import org.junit.Test;
4+
import org.junit.Assert.assertEquals
5+
6+
class HelloServiceTest
7+
{
8+
@Test
9+
def test2()
10+
{
11+
assertEquals("Hello from module 2", HelloService2.hello)
12+
}
13+
14+
}
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
5+
<parent>
6+
<groupId>it.scoverage-maven-plugin</groupId>
7+
<artifactId>test_aggregate</artifactId>
8+
<version>1.0-SNAPSHOT</version>
9+
<relativePath>../pom.xml</relativePath>
10+
</parent>
11+
12+
<modelVersion>4.0.0</modelVersion>
13+
<artifactId>module03</artifactId>
14+
<name>Test SCoverage Aggregation : Module 3</name>
15+
16+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package pkg03
2+
3+
class HelloService3
4+
{
5+
def hello =
6+
{
7+
"Hello from module 3"
8+
}
9+
10+
}
11+
12+
object HelloService3 extends HelloService3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package pkg03
2+
3+
import org.junit.Test;
4+
import org.junit.Assert.assertEquals
5+
6+
class HelloServiceTest
7+
{
8+
@Test
9+
def test3()
10+
{
11+
assertEquals("Hello from module 3", HelloService3.hello)
12+
}
13+
14+
}

src/it/test_aggregate/pom.xml

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<parent>
8+
<groupId>it.scoverage-maven-plugin</groupId>
9+
<artifactId>integration_tests_parent</artifactId>
10+
<version>1.0-SNAPSHOT</version>
11+
<relativePath>../integration_tests_parent/pom.xml</relativePath>
12+
</parent>
13+
14+
<artifactId>test_aggregate</artifactId>
15+
<version>1.0-SNAPSHOT</version>
16+
<packaging>pom</packaging>
17+
<name>Test Scoverage aggregation</name>
18+
<description>Test Scoverage aggregation</description>
19+
20+
<properties>
21+
<scala.compat.version>2.13</scala.compat.version>
22+
<scala.minor.version>12</scala.minor.version>
23+
</properties>
24+
25+
<modules>
26+
<module>module01</module>
27+
<module>module02</module>
28+
<module>module03</module>
29+
</modules>
30+
31+
<build>
32+
<plugins>
33+
<plugin>
34+
<groupId>org.apache.maven.plugins</groupId>
35+
<artifactId>maven-compiler-plugin</artifactId>
36+
</plugin>
37+
<plugin>
38+
<groupId>net.alchim31.maven</groupId>
39+
<artifactId>scala-maven-plugin</artifactId>
40+
</plugin>
41+
<plugin>
42+
<groupId>org.apache.maven.plugins</groupId>
43+
<artifactId>maven-surefire-plugin</artifactId>
44+
</plugin>
45+
<plugin>
46+
<groupId>@project.groupId@</groupId>
47+
<artifactId>@project.artifactId@</artifactId>
48+
<configuration>
49+
<aggregate>true</aggregate> <!-- for aggregated report -->
50+
</configuration>
51+
</plugin>
52+
</plugins>
53+
</build>
54+
55+
<reporting>
56+
<plugins>
57+
<plugin>
58+
<groupId>@project.groupId@</groupId>
59+
<artifactId>@project.artifactId@</artifactId>
60+
<configuration>
61+
<aggregate>true</aggregate> <!-- for aggregated report -->
62+
</configuration>
63+
</plugin>
64+
</plugins>
65+
</reporting>
66+
</project>

src/it/test_aggregate/validate.groovy

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
try {
2+
3+
def module1ScoverageFile = new File(basedir, "module01/target/scoverage.xml")
4+
assert module1ScoverageFile.exists()
5+
6+
def module1ReportFile = new File(basedir, "module01/target/site/scoverage/index.html")
7+
assert module1ReportFile.exists()
8+
9+
def module2ScoverageFile = new File(basedir, "module02/target/scoverage.xml")
10+
assert module2ScoverageFile.exists()
11+
12+
def module2ReportFile = new File(basedir, "module02/target/site/scoverage/index.html")
13+
assert module2ReportFile.exists()
14+
15+
def module3ScoverageFile = new File(basedir, "module03/target/scoverage.xml")
16+
assert module3ScoverageFile.exists()
17+
18+
def module3ReportFile = new File(basedir, "module03/target/site/scoverage/index.html")
19+
assert module3ReportFile.exists()
20+
21+
def aggregatedScoverageFile = new File(basedir, "target/scoverage.xml")
22+
assert aggregatedScoverageFile.exists()
23+
24+
def aggregatedReportFile = new File(basedir, "target/site/scoverage/index.html")
25+
assert aggregatedReportFile.exists()
26+
27+
return true
28+
29+
} catch (Throwable e) {
30+
e.printStackTrace()
31+
return false
32+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
invoker.goals=clean verify site -e -ntp
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
5+
<parent>
6+
<groupId>it.scoverage-maven-plugin</groupId>
7+
<artifactId>test_aggregate_only</artifactId>
8+
<version>1.0-SNAPSHOT</version>
9+
<relativePath>../pom.xml</relativePath>
10+
</parent>
11+
12+
<modelVersion>4.0.0</modelVersion>
13+
<artifactId>module01</artifactId>
14+
<name>Test SCoverage Only Aggregation : Module 1</name>
15+
16+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package pkg01
2+
3+
class HelloService1
4+
{
5+
def hello =
6+
{
7+
"Hello from module 1"
8+
}
9+
10+
}
11+
12+
object HelloService1 extends HelloService1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package pkg01
2+
3+
import org.junit.Test;
4+
import org.junit.Assert.assertEquals
5+
6+
class HelloServiceTest
7+
{
8+
@Test
9+
def test1()
10+
{
11+
assertEquals("Hello from module 1", HelloService1.hello)
12+
}
13+
14+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
5+
<parent>
6+
<groupId>it.scoverage-maven-plugin</groupId>
7+
<artifactId>test_aggregate_only</artifactId>
8+
<version>1.0-SNAPSHOT</version>
9+
<relativePath>../pom.xml</relativePath>
10+
</parent>
11+
12+
<modelVersion>4.0.0</modelVersion>
13+
<artifactId>module02</artifactId>
14+
<name>Test SCoverage Only Aggregation : Module 2</name>
15+
16+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package pkg02
2+
3+
class HelloService2
4+
{
5+
def hello =
6+
{
7+
"Hello from module 2"
8+
}
9+
10+
}
11+
12+
object HelloService2 extends HelloService2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package pkg02
2+
3+
import org.junit.Test;
4+
import org.junit.Assert.assertEquals
5+
6+
class HelloServiceTest
7+
{
8+
@Test
9+
def test2()
10+
{
11+
assertEquals("Hello from module 2", HelloService2.hello)
12+
}
13+
14+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
5+
<parent>
6+
<groupId>it.scoverage-maven-plugin</groupId>
7+
<artifactId>test_aggregate_only</artifactId>
8+
<version>1.0-SNAPSHOT</version>
9+
<relativePath>../pom.xml</relativePath>
10+
</parent>
11+
12+
<modelVersion>4.0.0</modelVersion>
13+
<artifactId>module03</artifactId>
14+
<name>Test SCoverage Only Aggregation : Module 3</name>
15+
16+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package pkg03
2+
3+
class HelloService3
4+
{
5+
def hello =
6+
{
7+
"Hello from module 3"
8+
}
9+
10+
}
11+
12+
object HelloService3 extends HelloService3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package pkg03
2+
3+
import org.junit.Test;
4+
import org.junit.Assert.assertEquals
5+
6+
class HelloServiceTest
7+
{
8+
@Test
9+
def test3()
10+
{
11+
assertEquals("Hello from module 3", HelloService3.hello)
12+
}
13+
14+
}

0 commit comments

Comments
 (0)