Permalink
Browse files

Added an integration test for the new multi-format report output feature

  • Loading branch information...
1 parent 616dc07 commit c48add552e623ad9715067464e9957f4bcd6d00d Andrew Phillips committed Jul 7, 2011
View
@@ -0,0 +1,72 @@
+<?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>
+ <groupId>emma.test</groupId>
+ <artifactId>it06</artifactId>
+ <version>1.0</version>
+ <name>EMMA plugin :: Integration test 06</name>
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.2</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <profiles>
+ <profile>
+ <id>maven-2</id>
+ <activation>
+ <file>
+ <!-- only recognized by Maven 3.x (see MNG-2363) -->
+ <missing>${basedir}</missing>
+ </file>
+ </activation>
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.sonatype.maven.plugin</groupId>
+ <artifactId>emma-maven-plugin</artifactId>
+ <version>@project.version@</version>
+ <configuration>
+ <formats>html,xml,txt</formats>
+ </configuration>
+ </plugin>
+ </plugins>
+ </reporting>
+ </profile>
+ <profile>
+ <id>maven-3</id>
+ <activation>
+ <file>
+ <!-- only recognized by Maven 3.x (see MNG-2363) -->
+ <exists>${basedir}</exists>
+ </file>
+ </activation>
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <artifactId>maven-site-plugin</artifactId>
+ <version>3.0-beta-3</version>
+ <configuration>
+ <reportPlugins>
+ <plugin>
+ <groupId>org.sonatype.maven.plugin</groupId>
+ <artifactId>emma-maven-plugin</artifactId>
+ <version>@project.version@</version>
+ <configuration>
+ <formats>html,xml,txt</formats>
+ </configuration>
+ </plugin>
+ </reportPlugins>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+ </profile>
+ </profiles>
+</project>
@@ -0,0 +1,10 @@
+package hello;
+
+public class Hello
+{
+ public String hello( String name )
+ {
+ final String myName = name == null ? "world" : name;
+ return "Hello " + myName + "!";
+ }
+}
@@ -0,0 +1,13 @@
+package hello;
+
+import junit.framework.TestCase;
+
+public class HelloTest extends TestCase
+{
+ public void testHello()
+ {
+ final Hello hello = new Hello();
+ assertEquals( "Hello world!", hello.hello( null ) );
+ assertEquals( "Hello EMMA!", hello.hello( "EMMA" ) );
+ }
+}
View
@@ -0,0 +1,19 @@
+File emmaIndex = new File(basedir, "target/site/emma/index.html");
+if(!emmaIndex.exists() || emmaIndex.length() == 0) {
+ System.out.println("Missing 'index.html'");
+ return false;
+}
+
+File emmaXmlReport = new File(basedir, "target/site/emma/coverage.xml");
+if(!emmaXmlReport.exists() || emmaXmlReport.length() == 0) {
+ System.out.println("Missing 'coverage.xml'");
+ return false;
+}
+
+File emmaTxtReport = new File(basedir, "target/site/emma/coverage.txt");
+if(!emmaTxtReport.exists() || emmaTxtReport.length() == 0) {
+ System.out.println("Missing 'coverage.txt'");
+ return false;
+}
+
+return true;

0 comments on commit c48add5

Please sign in to comment.