diff options
author | Marc R. Hoffmann <hoffmann@mountainminds.com> | 2016-04-19 13:22:01 +0200 |
---|---|---|
committer | Evgeny Mandrikov <Godin@users.noreply.github.com> | 2016-04-19 13:22:01 +0200 |
commit | c181f60ce08ec9b0a6f59a2391c33c41bca8f1c0 (patch) | |
tree | 714c1ffa8b66fde4037131aade0269f63c8a40b6 /jacoco-maven-plugin.test/it | |
parent | bac679b3ae6363f1d610e705139f0e1964b319ea (diff) | |
download | jacoco-c181f60ce08ec9b0a6f59a2391c33c41bca8f1c0.tar.gz |
GitHub #388: New Maven goal "report-aggregate" to create reports for multi-module projects
Diffstat (limited to 'jacoco-maven-plugin.test/it')
16 files changed, 364 insertions, 4 deletions
diff --git a/jacoco-maven-plugin.test/it/it-multi-module/verify.bsh b/jacoco-maven-plugin.test/it/it-multi-module/verify.bsh index 7efaea9d..55935690 100644 --- a/jacoco-maven-plugin.test/it/it-multi-module/verify.bsh +++ b/jacoco-maven-plugin.test/it/it-multi-module/verify.bsh @@ -13,7 +13,7 @@ import java.io.*; import org.codehaus.plexus.util.*; String buildLog = FileUtils.fileRead( new File( basedir, "build.log" ) ); -if ( buildLog.indexOf( "Skipping JaCoCo execution due to missing classes directory:" ) < 0 ) { +if ( buildLog.indexOf( "Skipping JaCoCo execution due to missing classes directory." ) < 0 ) { throw new RuntimeException( "Execution should be skipped when target/classes does not exist." ); } diff --git a/jacoco-maven-plugin.test/it/it-report-aggregate/child1-test/pom.xml b/jacoco-maven-plugin.test/it/it-report-aggregate/child1-test/pom.xml new file mode 100644 index 00000000..d65b7a63 --- /dev/null +++ b/jacoco-maven-plugin.test/it/it-report-aggregate/child1-test/pom.xml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Copyright (c) 2009, 2016 Mountainminds GmbH & Co. KG and Contributors + All rights reserved. This program and the accompanying materials + are made available under the terms of the Eclipse Public License v1.0 + which accompanies this distribution, and is available at + http://www.eclipse.org/legal/epl-v10.html + + Contributors: + Marc R. Hoffmann, Jan Wloka - initial API and implementation +--> +<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"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>jacoco</groupId> + <artifactId>it-report-aggregate</artifactId> + <version>1.0-SNAPSHOT</version> + </parent> + + <artifactId>child1-test</artifactId> + <packaging>jar</packaging> + + <dependencies> + <dependency> + <groupId>jacoco</groupId> + <artifactId>child1</artifactId> + <version>${project.version}</version> + </dependency> + </dependencies> + +</project> diff --git a/jacoco-maven-plugin.test/it/it-report-aggregate/child1-test/src/test/java/package1/Example1bTest.java b/jacoco-maven-plugin.test/it/it-report-aggregate/child1-test/src/test/java/package1/Example1bTest.java new file mode 100644 index 00000000..2b621c63 --- /dev/null +++ b/jacoco-maven-plugin.test/it/it-report-aggregate/child1-test/src/test/java/package1/Example1bTest.java @@ -0,0 +1,23 @@ +/******************************************************************************* + * Copyright (c) 2009, 2016 Mountainminds GmbH & Co. KG and Contributors + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Marc R. Hoffmann, Jan Wloka - initial API and implementation + * + *******************************************************************************/ +package package1; + +import org.junit.Test; + +public class Example1bTest { + + @Test + public void test() { + new Example1b().b(); + } + +} diff --git a/jacoco-maven-plugin.test/it/it-report-aggregate/child1/pom.xml b/jacoco-maven-plugin.test/it/it-report-aggregate/child1/pom.xml new file mode 100644 index 00000000..530e0a1a --- /dev/null +++ b/jacoco-maven-plugin.test/it/it-report-aggregate/child1/pom.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Copyright (c) 2009, 2016 Mountainminds GmbH & Co. KG and Contributors + All rights reserved. This program and the accompanying materials + are made available under the terms of the Eclipse Public License v1.0 + which accompanies this distribution, and is available at + http://www.eclipse.org/legal/epl-v10.html + + Contributors: + Marc R. Hoffmann, Jan Wloka - initial API and implementation +--> +<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"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>jacoco</groupId> + <artifactId>it-report-aggregate</artifactId> + <version>1.0-SNAPSHOT</version> + </parent> + + <artifactId>child1</artifactId> + <packaging>jar</packaging> + +</project> diff --git a/jacoco-maven-plugin.test/it/it-report-aggregate/child1/src/main/java/package1/Example1a.java b/jacoco-maven-plugin.test/it/it-report-aggregate/child1/src/main/java/package1/Example1a.java new file mode 100644 index 00000000..99e65345 --- /dev/null +++ b/jacoco-maven-plugin.test/it/it-report-aggregate/child1/src/main/java/package1/Example1a.java @@ -0,0 +1,19 @@ +/******************************************************************************* + * Copyright (c) 2009, 2016 Mountainminds GmbH & Co. KG and Contributors + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Marc R. Hoffmann, Jan Wloka - initial API and implementation + * + *******************************************************************************/ +package package1; + +public class Example1a { + + public void a() { + } + +} diff --git a/jacoco-maven-plugin.test/it/it-report-aggregate/child1/src/main/java/package1/Example1b.java b/jacoco-maven-plugin.test/it/it-report-aggregate/child1/src/main/java/package1/Example1b.java new file mode 100644 index 00000000..a5741466 --- /dev/null +++ b/jacoco-maven-plugin.test/it/it-report-aggregate/child1/src/main/java/package1/Example1b.java @@ -0,0 +1,19 @@ +/******************************************************************************* + * Copyright (c) 2009, 2016 Mountainminds GmbH & Co. KG and Contributors + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Marc R. Hoffmann, Jan Wloka - initial API and implementation + * + *******************************************************************************/ +package package1; + +public class Example1b { + + public void b() { + } + +} diff --git a/jacoco-maven-plugin.test/it/it-report-aggregate/child1/src/test/java/package1/Example1aTest.java b/jacoco-maven-plugin.test/it/it-report-aggregate/child1/src/test/java/package1/Example1aTest.java new file mode 100644 index 00000000..04ffa75c --- /dev/null +++ b/jacoco-maven-plugin.test/it/it-report-aggregate/child1/src/test/java/package1/Example1aTest.java @@ -0,0 +1,23 @@ +/******************************************************************************* + * Copyright (c) 2009, 2016 Mountainminds GmbH & Co. KG and Contributors + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Marc R. Hoffmann, Jan Wloka - initial API and implementation + * + *******************************************************************************/ +package package1; + +import org.junit.Test; + +public class Example1aTest { + + @Test + public void test() { + new Example1a().a(); + } + +} diff --git a/jacoco-maven-plugin.test/it/it-report-aggregate/child2/pom.xml b/jacoco-maven-plugin.test/it/it-report-aggregate/child2/pom.xml new file mode 100644 index 00000000..e340ca2d --- /dev/null +++ b/jacoco-maven-plugin.test/it/it-report-aggregate/child2/pom.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Copyright (c) 2009, 2016 Mountainminds GmbH & Co. KG and Contributors + All rights reserved. This program and the accompanying materials + are made available under the terms of the Eclipse Public License v1.0 + which accompanies this distribution, and is available at + http://www.eclipse.org/legal/epl-v10.html + + Contributors: + Marc R. Hoffmann, Jan Wloka - initial API and implementation +--> +<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"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>jacoco</groupId> + <artifactId>it-report-aggregate</artifactId> + <version>1.0-SNAPSHOT</version> + </parent> + + <artifactId>child2</artifactId> + <packaging>jar</packaging> + +</project> diff --git a/jacoco-maven-plugin.test/it/it-report-aggregate/child2/src/main/java/package2/Example2.java b/jacoco-maven-plugin.test/it/it-report-aggregate/child2/src/main/java/package2/Example2.java new file mode 100644 index 00000000..5895fbb9 --- /dev/null +++ b/jacoco-maven-plugin.test/it/it-report-aggregate/child2/src/main/java/package2/Example2.java @@ -0,0 +1,19 @@ +/******************************************************************************* + * Copyright (c) 2009, 2016 Mountainminds GmbH & Co. KG and Contributors + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Marc R. Hoffmann, Jan Wloka - initial API and implementation + * + *******************************************************************************/ +package package2; + +public class Example2 { + + public void a() { + } + +} diff --git a/jacoco-maven-plugin.test/it/it-report-aggregate/child2/src/test/java/package2/Example2Test.java b/jacoco-maven-plugin.test/it/it-report-aggregate/child2/src/test/java/package2/Example2Test.java new file mode 100644 index 00000000..f382fc2b --- /dev/null +++ b/jacoco-maven-plugin.test/it/it-report-aggregate/child2/src/test/java/package2/Example2Test.java @@ -0,0 +1,23 @@ +/******************************************************************************* + * Copyright (c) 2009, 2016 Mountainminds GmbH & Co. KG and Contributors + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Marc R. Hoffmann, Jan Wloka - initial API and implementation + * + *******************************************************************************/ +package package2; + +import org.junit.Test; + +public class Example2Test { + + @Test + public void test() { + new Example2().a(); + } + +} diff --git a/jacoco-maven-plugin.test/it/it-report-aggregate/pom.xml b/jacoco-maven-plugin.test/it/it-report-aggregate/pom.xml new file mode 100644 index 00000000..71b7a196 --- /dev/null +++ b/jacoco-maven-plugin.test/it/it-report-aggregate/pom.xml @@ -0,0 +1,48 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Copyright (c) 2009, 2016 Mountainminds GmbH & Co. KG and Contributors + All rights reserved. This program and the accompanying materials + are made available under the terms of the Eclipse Public License v1.0 + which accompanies this distribution, and is available at + http://www.eclipse.org/legal/epl-v10.html + + Contributors: + Marc R. Hoffmann, Jan Wloka - initial API and implementation +--> +<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>jacoco</groupId> + <artifactId>setup-parent</artifactId> + <version>1.0-SNAPSHOT</version> + </parent> + + <artifactId>it-report-aggregate</artifactId> + <packaging>pom</packaging> + + <modules> + <module>child1</module> + <module>child1-test</module> + <module>child2</module> + <module>report</module> + </modules> + + <build> + <plugins> + <plugin> + <groupId>@project.groupId@</groupId> + <artifactId>jacoco-maven-plugin</artifactId> + <executions> + <execution> + <id>prepare-agent</id> + <goals> + <goal>prepare-agent</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project> diff --git a/jacoco-maven-plugin.test/it/it-report-aggregate/report/pom.xml b/jacoco-maven-plugin.test/it/it-report-aggregate/report/pom.xml new file mode 100644 index 00000000..d6e6fc74 --- /dev/null +++ b/jacoco-maven-plugin.test/it/it-report-aggregate/report/pom.xml @@ -0,0 +1,62 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Copyright (c) 2009, 2016 Mountainminds GmbH & Co. KG and Contributors + All rights reserved. This program and the accompanying materials + are made available under the terms of the Eclipse Public License v1.0 + which accompanies this distribution, and is available at + http://www.eclipse.org/legal/epl-v10.html + + Contributors: + Marc R. Hoffmann, Jan Wloka - initial API and implementation +--> +<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"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>jacoco</groupId> + <artifactId>it-report-aggregate</artifactId> + <version>1.0-SNAPSHOT</version> + </parent> + + <artifactId>report</artifactId> + <name>Aggregate Report</name> + + <dependencies> + <dependency> + <groupId>jacoco</groupId> + <artifactId>child1</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>jacoco</groupId> + <artifactId>child1-test</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>jacoco</groupId> + <artifactId>child2</artifactId> + <version>${project.version}</version> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>@project.groupId@</groupId> + <artifactId>jacoco-maven-plugin</artifactId> + <executions> + <execution> + <id>report-aggregate</id> + <phase>verify</phase> + <goals> + <goal>report-aggregate</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + +</project> diff --git a/jacoco-maven-plugin.test/it/it-report-aggregate/verify.bsh b/jacoco-maven-plugin.test/it/it-report-aggregate/verify.bsh new file mode 100644 index 00000000..32a52dc1 --- /dev/null +++ b/jacoco-maven-plugin.test/it/it-report-aggregate/verify.bsh @@ -0,0 +1,41 @@ +/******************************************************************************* + * Copyright (c) 2009, 2016 Mountainminds GmbH & Co. KG and Contributors + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Marc R. Hoffmann, Jan Wloka - initial API and implementation + * + *******************************************************************************/ +import org.codehaus.plexus.util.*; + +String buildLog = FileUtils.fileRead( new File( basedir, "build.log" ) ); + +if ( buildLog.indexOf( "/child1/target/jacoco.exec" ) < 0 ) { + throw new RuntimeException( "Execution data from child1 was not loaded." ); +} + +if ( buildLog.indexOf( "/child1-test/target/jacoco.exec" ) < 0 ) { + throw new RuntimeException( "Execution data from child1-test was not loaded." ); +} + +if ( buildLog.indexOf( "/child2/target/jacoco.exec" ) < 0 ) { + throw new RuntimeException( "Execution data from child2 was not loaded." ); +} + +File reportChild1 = new File( basedir, "report/target/site/jacoco-aggregate/child1/index.html" ); +if ( !reportChild1.isFile() ) { + throw new RuntimeException( "Report for child1 was not created." ); +} + +File reportChild1test = new File( basedir, "report/target/site/jacoco-aggregate/child1-test/index.html" ); +if ( reportChild1test.isFile() ) { + throw new RuntimeException( "Report for child1-test should not be created." ); +} + +File reportChild2 = new File( basedir, "report/target/site/jacoco-aggregate/child2/index.html" ); +if ( !reportChild2.isFile() ) { + throw new RuntimeException( "Report for child2 was not created." ); +} diff --git a/jacoco-maven-plugin.test/it/it-report-unreadable-dump/verify.bsh b/jacoco-maven-plugin.test/it/it-report-unreadable-dump/verify.bsh index 90a58a95..a53ee995 100644 --- a/jacoco-maven-plugin.test/it/it-report-unreadable-dump/verify.bsh +++ b/jacoco-maven-plugin.test/it/it-report-unreadable-dump/verify.bsh @@ -13,6 +13,6 @@ import java.io.*; import org.codehaus.plexus.util.*; String buildLog = FileUtils.fileRead( new File( basedir, "build.log" ) ); -if ( buildLog.indexOf( "Unable to read execution data file" ) < 0 ) { +if ( buildLog.indexOf( "Invalid execution data file." ) < 0 ) { throw new RuntimeException( "Error was not printed" ); } diff --git a/jacoco-maven-plugin.test/it/it-site-failsafe/verify.bsh b/jacoco-maven-plugin.test/it/it-site-failsafe/verify.bsh index 00a7667c..458148bd 100644 --- a/jacoco-maven-plugin.test/it/it-site-failsafe/verify.bsh +++ b/jacoco-maven-plugin.test/it/it-site-failsafe/verify.bsh @@ -13,7 +13,7 @@ import java.io.*; import org.codehaus.plexus.util.*; String projectReportsPage = FileUtils.fileRead( new File( basedir, "target/site/project-reports.html" ) ); -if ( projectReportsPage.indexOf( "JaCoCo Test Coverage Report." ) < 0 ) { +if ( projectReportsPage.indexOf( "JaCoCo Coverage Report." ) < 0 ) { throw new RuntimeException( "project-reports.html does not contain link to JaCoCo report" ); } diff --git a/jacoco-maven-plugin.test/it/it-site/verify.bsh b/jacoco-maven-plugin.test/it/it-site/verify.bsh index f2ea8293..d1c7cd32 100644 --- a/jacoco-maven-plugin.test/it/it-site/verify.bsh +++ b/jacoco-maven-plugin.test/it/it-site/verify.bsh @@ -13,7 +13,7 @@ import java.io.*; import org.codehaus.plexus.util.*; String projectReportsPage = FileUtils.fileRead( new File( basedir, "target/site/project-reports.html" ) ); -if ( projectReportsPage.indexOf( "JaCoCo Test Coverage Report." ) < 0 ) { +if ( projectReportsPage.indexOf( "JaCoCo Coverage Report." ) < 0 ) { throw new RuntimeException( "project-reports.html does not contain link to JaCoCo report" ); } |