aboutsummaryrefslogtreecommitdiff
path: root/jacoco-maven-plugin.test/it
diff options
context:
space:
mode:
authorMirko Friedenhagen <mfriedenhagen@gmail.com>2013-11-01 20:41:22 +0100
committerMirko Friedenhagen <mfriedenhagen@gmail.com>2013-11-01 20:41:22 +0100
commit11fe3a45efc2aef618c65e48bb1cc8ad506657bd (patch)
treec2aeffa602943f03313a6e3e9e53b39c69465e24 /jacoco-maven-plugin.test/it
parent7e99eee02aef7f621276855c07b7989789e414dd (diff)
downloadjacoco-11fe3a45efc2aef618c65e48bb1cc8ad506657bd.tar.gz
Add an integration test for failsafe AKA IT report.
Diffstat (limited to 'jacoco-maven-plugin.test/it')
-rw-r--r--jacoco-maven-plugin.test/it/it-site-failsafe/invoker.properties4
-rw-r--r--jacoco-maven-plugin.test/it/it-site-failsafe/pom.xml95
-rw-r--r--jacoco-maven-plugin.test/it/it-site-failsafe/src/main/java/Example.java22
-rw-r--r--jacoco-maven-plugin.test/it/it-site-failsafe/src/test/java/ExampleIT.java21
-rw-r--r--jacoco-maven-plugin.test/it/it-site-failsafe/src/test/java/ExampleTest.java21
-rw-r--r--jacoco-maven-plugin.test/it/it-site-failsafe/verify.bsh52
6 files changed, 215 insertions, 0 deletions
diff --git a/jacoco-maven-plugin.test/it/it-site-failsafe/invoker.properties b/jacoco-maven-plugin.test/it/it-site-failsafe/invoker.properties
new file mode 100644
index 00000000..2e64a55e
--- /dev/null
+++ b/jacoco-maven-plugin.test/it/it-site-failsafe/invoker.properties
@@ -0,0 +1,4 @@
+invoker.goals = clean verify site
+
+# maven-site-plugin 3.3 works with at least Maven 2.2.1+
+invoker.maven.version = 2.2.1+
diff --git a/jacoco-maven-plugin.test/it/it-site-failsafe/pom.xml b/jacoco-maven-plugin.test/it/it-site-failsafe/pom.xml
new file mode 100644
index 00000000..d2a66922
--- /dev/null
+++ b/jacoco-maven-plugin.test/it/it-site-failsafe/pom.xml
@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2009, 2013 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:
+ Evgeny Mandrikov - 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>setup-parent</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>it-site-failsafe</artifactId>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ <version>2.14.1</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.14.1</version>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>@project.groupId@</groupId>
+ <artifactId>jacoco-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-prepare-agent</id>
+ <goals>
+ <goal>prepare-agent</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>default-prepare-agent-integration</id>
+ <goals>
+ <goal>prepare-agent-integration</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>default-report-integration</id>
+ <goals>
+ <goal>report-integration</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-integration-test</id>
+ <goals>
+ <goal>integration-test</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-site-plugin</artifactId>
+ <!-- version 3.3 is needed as 3.2 is not able to produce multiple reports. -->
+ <version>3.3</version>
+ </plugin>
+ </plugins>
+ </build>
+
+ <reporting>
+ <excludeDefaults>true</excludeDefaults>
+ <plugins>
+ <plugin>
+ <groupId>@project.groupId@</groupId>
+ <artifactId>jacoco-maven-plugin</artifactId>
+ <version>@project.version@</version>
+ </plugin>
+ </plugins>
+ </reporting>
+</project>
diff --git a/jacoco-maven-plugin.test/it/it-site-failsafe/src/main/java/Example.java b/jacoco-maven-plugin.test/it/it-site-failsafe/src/main/java/Example.java
new file mode 100644
index 00000000..654d3bd5
--- /dev/null
+++ b/jacoco-maven-plugin.test/it/it-site-failsafe/src/main/java/Example.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2013 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:
+ * Evgeny Mandrikov - initial API and implementation
+ *
+ *******************************************************************************/
+public class Example {
+
+ public void sayHello() {
+ System.out.println("Hello world");
+ }
+
+ public void sayHelloIT() {
+ System.out.println("Hello world");
+ }
+
+}
diff --git a/jacoco-maven-plugin.test/it/it-site-failsafe/src/test/java/ExampleIT.java b/jacoco-maven-plugin.test/it/it-site-failsafe/src/test/java/ExampleIT.java
new file mode 100644
index 00000000..df6d8b05
--- /dev/null
+++ b/jacoco-maven-plugin.test/it/it-site-failsafe/src/test/java/ExampleIT.java
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2013 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:
+ * Evgeny Mandrikov - initial API and implementation
+ *
+ *******************************************************************************/
+import org.junit.Test;
+
+public class ExampleIT {
+
+ @Test
+ public void test() {
+ new Example().sayHelloIT();
+ }
+
+}
diff --git a/jacoco-maven-plugin.test/it/it-site-failsafe/src/test/java/ExampleTest.java b/jacoco-maven-plugin.test/it/it-site-failsafe/src/test/java/ExampleTest.java
new file mode 100644
index 00000000..d9b78ab9
--- /dev/null
+++ b/jacoco-maven-plugin.test/it/it-site-failsafe/src/test/java/ExampleTest.java
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2013 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:
+ * Evgeny Mandrikov - initial API and implementation
+ *
+ *******************************************************************************/
+import org.junit.Test;
+
+public class ExampleTest {
+
+ @Test
+ public void test() {
+ new Example().sayHello();
+ }
+
+}
diff --git a/jacoco-maven-plugin.test/it/it-site-failsafe/verify.bsh b/jacoco-maven-plugin.test/it/it-site-failsafe/verify.bsh
new file mode 100644
index 00000000..2c47ec24
--- /dev/null
+++ b/jacoco-maven-plugin.test/it/it-site-failsafe/verify.bsh
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2013 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:
+ * Evgeny Mandrikov - initial API and implementation
+ *
+ *******************************************************************************/
+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 ) {
+ throw new RuntimeException( "project-reports.html does not contain link to JaCoCo report" );
+}
+
+File htmlReportFile = new File( basedir, "target/site/jacoco/index.html" );
+if ( !htmlReportFile.isFile() ) {
+ throw new RuntimeException( "HTML report was not created" );
+}
+
+File xmlReportFile = new File( basedir, "target/site/jacoco/jacoco.xml" );
+if ( !xmlReportFile.isFile() ) {
+ throw new RuntimeException( "XML report was not created" );
+}
+
+File csvReportFile = new File( basedir, "target/site/jacoco/jacoco.csv" );
+if ( !csvReportFile.isFile() ) {
+ throw new RuntimeException( "CSV report was not created" );
+}
+
+if ( projectReportsPage.indexOf( "JaCoCo IT Coverage Report." ) < 0 ) {
+ throw new RuntimeException( "project-reports.html does not contain link to JaCoCo Integration report" );
+}
+
+File htmlReportFile = new File( basedir, "target/site/jacoco-it/index.html" );
+if ( !htmlReportFile.isFile() ) {
+ throw new RuntimeException( "Integration HTML report was not created" );
+}
+
+File xmlReportFile = new File( basedir, "target/site/jacoco-it/jacoco.xml" );
+if ( !xmlReportFile.isFile() ) {
+ throw new RuntimeException( "Integration XML report was not created" );
+}
+
+File csvReportFile = new File( basedir, "target/site/jacoco-it/jacoco.csv" );
+if ( !csvReportFile.isFile() ) {
+ throw new RuntimeException( "Integration CSV report was not created" );
+}