Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add aggregate and aggregateOnly tests #156

Merged
merged 1 commit into from
Dec 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/it/test_aggregate/invoker.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
invoker.goals=clean verify site -e -ntp
16 changes: 16 additions & 0 deletions src/it/test_aggregate/module01/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>

<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">

<parent>
<groupId>it.scoverage-maven-plugin</groupId>
<artifactId>test_aggregate</artifactId>
<version>1.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<modelVersion>4.0.0</modelVersion>
<artifactId>module01</artifactId>
<name>Test SCoverage Aggregation : Module 1</name>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package pkg01

class HelloService1
{
def hello =
{
"Hello from module 1"
}

}

object HelloService1 extends HelloService1
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package pkg01

import org.junit.Test;
import org.junit.Assert.assertEquals

class HelloServiceTest
{
@Test
def test1()
{
assertEquals("Hello from module 1", HelloService1.hello)
}

}
16 changes: 16 additions & 0 deletions src/it/test_aggregate/module02/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>

<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">

<parent>
<groupId>it.scoverage-maven-plugin</groupId>
<artifactId>test_aggregate</artifactId>
<version>1.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<modelVersion>4.0.0</modelVersion>
<artifactId>module02</artifactId>
<name>Test SCoverage Aggregation : Module 2</name>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package pkg02

class HelloService2
{
def hello =
{
"Hello from module 2"
}

}

object HelloService2 extends HelloService2
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package pkg02

import org.junit.Test;
import org.junit.Assert.assertEquals

class HelloServiceTest
{
@Test
def test2()
{
assertEquals("Hello from module 2", HelloService2.hello)
}

}
16 changes: 16 additions & 0 deletions src/it/test_aggregate/module03/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>

<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">

<parent>
<groupId>it.scoverage-maven-plugin</groupId>
<artifactId>test_aggregate</artifactId>
<version>1.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<modelVersion>4.0.0</modelVersion>
<artifactId>module03</artifactId>
<name>Test SCoverage Aggregation : Module 3</name>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package pkg03

class HelloService3
{
def hello =
{
"Hello from module 3"
}

}

object HelloService3 extends HelloService3
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package pkg03

import org.junit.Test;
import org.junit.Assert.assertEquals

class HelloServiceTest
{
@Test
def test3()
{
assertEquals("Hello from module 3", HelloService3.hello)
}

}
66 changes: 66 additions & 0 deletions src/it/test_aggregate/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<?xml version="1.0" encoding="UTF-8"?>

<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>it.scoverage-maven-plugin</groupId>
<artifactId>integration_tests_parent</artifactId>
<version>1.0-SNAPSHOT</version>
<relativePath>../integration_tests_parent/pom.xml</relativePath>
</parent>

<artifactId>test_aggregate</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Test Scoverage aggregation</name>
<description>Test Scoverage aggregation</description>

<properties>
<scala.compat.version>2.13</scala.compat.version>
<scala.minor.version>12</scala.minor.version>
</properties>

<modules>
<module>module01</module>
<module>module02</module>
<module>module03</module>
</modules>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
</plugin>
<plugin>
<groupId>@project.groupId@</groupId>
<artifactId>@project.artifactId@</artifactId>
<configuration>
<aggregate>true</aggregate> <!-- for aggregated report -->
</configuration>
</plugin>
</plugins>
</build>

<reporting>
<plugins>
<plugin>
<groupId>@project.groupId@</groupId>
<artifactId>@project.artifactId@</artifactId>
<configuration>
<aggregate>true</aggregate> <!-- for aggregated report -->
</configuration>
</plugin>
</plugins>
</reporting>
</project>
32 changes: 32 additions & 0 deletions src/it/test_aggregate/validate.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
try {

def module1ScoverageFile = new File(basedir, "module01/target/scoverage.xml")
assert module1ScoverageFile.exists()

def module1ReportFile = new File(basedir, "module01/target/site/scoverage/index.html")
assert module1ReportFile.exists()

def module2ScoverageFile = new File(basedir, "module02/target/scoverage.xml")
assert module2ScoverageFile.exists()

def module2ReportFile = new File(basedir, "module02/target/site/scoverage/index.html")
assert module2ReportFile.exists()

def module3ScoverageFile = new File(basedir, "module03/target/scoverage.xml")
assert module3ScoverageFile.exists()

def module3ReportFile = new File(basedir, "module03/target/site/scoverage/index.html")
assert module3ReportFile.exists()

def aggregatedScoverageFile = new File(basedir, "target/scoverage.xml")
assert aggregatedScoverageFile.exists()

def aggregatedReportFile = new File(basedir, "target/site/scoverage/index.html")
assert aggregatedReportFile.exists()

return true

} catch (Throwable e) {
e.printStackTrace()
return false
}
1 change: 1 addition & 0 deletions src/it/test_aggregate_only/invoker.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
invoker.goals=clean verify site -e -ntp
16 changes: 16 additions & 0 deletions src/it/test_aggregate_only/module01/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>

<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">

<parent>
<groupId>it.scoverage-maven-plugin</groupId>
<artifactId>test_aggregate_only</artifactId>
<version>1.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<modelVersion>4.0.0</modelVersion>
<artifactId>module01</artifactId>
<name>Test SCoverage Only Aggregation : Module 1</name>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package pkg01

class HelloService1
{
def hello =
{
"Hello from module 1"
}

}

object HelloService1 extends HelloService1
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package pkg01

import org.junit.Test;
import org.junit.Assert.assertEquals

class HelloServiceTest
{
@Test
def test1()
{
assertEquals("Hello from module 1", HelloService1.hello)
}

}
16 changes: 16 additions & 0 deletions src/it/test_aggregate_only/module02/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>

<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">

<parent>
<groupId>it.scoverage-maven-plugin</groupId>
<artifactId>test_aggregate_only</artifactId>
<version>1.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<modelVersion>4.0.0</modelVersion>
<artifactId>module02</artifactId>
<name>Test SCoverage Only Aggregation : Module 2</name>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package pkg02

class HelloService2
{
def hello =
{
"Hello from module 2"
}

}

object HelloService2 extends HelloService2
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package pkg02

import org.junit.Test;
import org.junit.Assert.assertEquals

class HelloServiceTest
{
@Test
def test2()
{
assertEquals("Hello from module 2", HelloService2.hello)
}

}
16 changes: 16 additions & 0 deletions src/it/test_aggregate_only/module03/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>

<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">

<parent>
<groupId>it.scoverage-maven-plugin</groupId>
<artifactId>test_aggregate_only</artifactId>
<version>1.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<modelVersion>4.0.0</modelVersion>
<artifactId>module03</artifactId>
<name>Test SCoverage Only Aggregation : Module 3</name>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package pkg03

class HelloService3
{
def hello =
{
"Hello from module 3"
}

}

object HelloService3 extends HelloService3
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package pkg03

import org.junit.Test;
import org.junit.Assert.assertEquals

class HelloServiceTest
{
@Test
def test3()
{
assertEquals("Hello from module 3", HelloService3.hello)
}

}
Loading