maven-surefire-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dfabul...@apache.org
Subject svn commit: r596385 - in /maven/surefire/trunk: ./ surefire-integration-tests/ surefire-integration-tests/src/ surefire-integration-tests/src/test/ surefire-integration-tests/src/test/java/ surefire-integration-tests/src/test/java/org/ surefire-integra...
Date Mon, 19 Nov 2007 18:05:24 GMT
Author: dfabulich
Date: Mon Nov 19 10:05:14 2007
New Revision: 596385

URL: http://svn.apache.org/viewvc?rev=596385&view=rev
Log:
Adding the first in a hopefully long line of surefire integration tests.  Will begin porting
more ITs from maven-surefire-plugin assuming this looks OK.

Added:
    maven/surefire/trunk/surefire-integration-tests/
    maven/surefire/trunk/surefire-integration-tests/pom.xml
    maven/surefire/trunk/surefire-integration-tests/src/
    maven/surefire/trunk/surefire-integration-tests/src/test/
    maven/surefire/trunk/surefire-integration-tests/src/test/java/
    maven/surefire/trunk/surefire-integration-tests/src/test/java/org/
    maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/
    maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/
    maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/
    maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/
    maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/DefaultConfigurationTest.java
    maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/HelperAssertions.java
    maven/surefire/trunk/surefire-integration-tests/src/test/resources/
    maven/surefire/trunk/surefire-integration-tests/src/test/resources/default-configuration/
    maven/surefire/trunk/surefire-integration-tests/src/test/resources/default-configuration/pom.xml
    maven/surefire/trunk/surefire-integration-tests/src/test/resources/default-configuration/src/
    maven/surefire/trunk/surefire-integration-tests/src/test/resources/default-configuration/src/test/
    maven/surefire/trunk/surefire-integration-tests/src/test/resources/default-configuration/src/test/java/
    maven/surefire/trunk/surefire-integration-tests/src/test/resources/default-configuration/src/test/java/BasicTest.java
Modified:
    maven/surefire/trunk/pom.xml

Modified: maven/surefire/trunk/pom.xml
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/pom.xml?rev=596385&r1=596384&r2=596385&view=diff
==============================================================================
--- maven/surefire/trunk/pom.xml (original)
+++ maven/surefire/trunk/pom.xml Mon Nov 19 10:05:14 2007
@@ -149,6 +149,7 @@
     <module>surefire-providers</module>
     <module>maven-surefire-plugin</module>
     <module>maven-surefire-report-plugin</module>
+    <module>surefire-integration-tests</module>
   </modules>
 
   <profiles>

Added: maven/surefire/trunk/surefire-integration-tests/pom.xml
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/pom.xml?rev=596385&view=auto
==============================================================================
--- maven/surefire/trunk/surefire-integration-tests/pom.xml (added)
+++ maven/surefire/trunk/surefire-integration-tests/pom.xml Mon Nov 19 10:05:14 2007
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+
+<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">
+  <parent>
+    <artifactId>surefire</artifactId>
+    <groupId>org.apache.maven.surefire</groupId>
+    <version>2.4-SNAPSHOT</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion> 
+  <groupId>org.apache.maven.surefire</groupId>
+  <artifactId>surefire-integration-tests</artifactId>
+  <name>Maven Surefire Integration Tests</name>
+  <build>
+    <plugins>
+      <plugin>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <version>${project.version}</version>
+        <configuration>
+          <!-- DGF only include the "org" package; don't try to run the 
+            tests of the projects under test directly -->
+          <includes>
+            <include>org/**/Test*.java</include>
+            <include>org/**/*Test.java</include>
+            <include>org/**/*TestCase.java</include>
+          </includes>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+  <dependencies>
+    <!-- DGF Depend on the SurefireReportParser -->
+    <dependency>
+      <artifactId>maven-surefire-report-plugin</artifactId>
+      <groupId>org.apache.maven.plugins</groupId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.shared</groupId>
+      <artifactId>maven-verifier</artifactId>
+      <version>1.0</version>
+    </dependency>
+    <dependency>
+	  <groupId>org.apache.maven.its</groupId>
+	  <artifactId>maven-integration-test-helper</artifactId>
+	  <version>1.0-SNAPSHOT</version>
+	</dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>3.8.1</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+   <!-- TODO: remove when snapshots are released -->
+	<repositories>
+		<repository>
+			<id>apache.snapshots</id>
+			<url>http://people.apache.org/repo/m2-snapshot-repository</url>
+			<releases>
+				<enabled>false</enabled>
+			</releases>
+			<snapshots>
+			    <enabled>true</enabled>
+			</snapshots>
+		</repository>
+	</repositories>
+</project>

Added: maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/DefaultConfigurationTest.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/DefaultConfigurationTest.java?rev=596385&view=auto
==============================================================================
--- maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/DefaultConfigurationTest.java
(added)
+++ maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/DefaultConfigurationTest.java
Mon Nov 19 10:05:14 2007
@@ -0,0 +1,47 @@
+package org.apache.maven.surefire.its;
+
+import java.io.File;
+import java.util.List;
+
+import org.apache.maven.integrationtests.AbstractMavenIntegrationTestCase;
+import org.apache.maven.it.Verifier;
+import org.apache.maven.it.util.ResourceExtractor;
+import org.apache.maven.plugins.surefire.report.ReportTestSuite;
+import org.apache.maven.plugins.surefire.report.SurefireReportParser;
+
+/**
+ * Test basic default configuration, runs the JUnit 3 test in the src/test directory.
+ * 
+ * @author <a href="mailto:dfabulich@apache.org">Dan Fabulich</a>
+ * 
+ */
+public class DefaultConfigurationTest
+    extends AbstractMavenIntegrationTestCase
+{
+    public void testDefaultConfiguration ()
+        throws Exception
+    {
+        File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/default-configuration"
);
+
+        Verifier verifier;
+
+        verifier = new Verifier( testDir.getAbsolutePath() );
+        verifier.deleteArtifact( "org.apache.maven.surefire.its", "default-configuration",
"1.0-SNAPSHOT", "jar" );
+
+//        verifier.executeGoal( "clean" );
+//        verifier.verifyErrorFreeLog();
+//        verifier.resetStreams();
+        verifier.executeGoal( "test" );
+        verifier.verifyErrorFreeLog();
+        verifier.resetStreams();
+        SurefireReportParser parser = new SurefireReportParser();
+        File reportsDir = new File( testDir, "target/surefire-reports" );
+        assertTrue( "Reports directory is missing: " + reportsDir.getAbsolutePath(), reportsDir.exists()
);
+        parser.setReportsDirectory( reportsDir );
+        List reports = parser.parseXMLReportFiles();
+        assertTrue( "No reports!", reports.size() > 0 );
+        ReportTestSuite suite = (ReportTestSuite) reports.get( 0 );
+        HelperAssertions.assertTestSuite( 1, 0, 0, 0, suite );
+        
+    }
+}

Added: maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/HelperAssertions.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/HelperAssertions.java?rev=596385&view=auto
==============================================================================
--- maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/HelperAssertions.java
(added)
+++ maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/HelperAssertions.java
Mon Nov 19 10:05:14 2007
@@ -0,0 +1,15 @@
+package org.apache.maven.surefire.its;
+
+import junit.framework.Assert;
+
+import org.apache.maven.plugins.surefire.report.ReportTestSuite;
+
+public class HelperAssertions
+{
+    public static void assertTestSuite(int total, int errors, int failures, int skipped,
ReportTestSuite actualSuite) {
+        Assert.assertEquals( "wrong number of tests", total, actualSuite.getNumberOfTests()
);
+        Assert.assertEquals( "wrong number of errors", errors, actualSuite.getNumberOfErrors()
);
+        Assert.assertEquals( "wrong number of failures", failures, actualSuite.getNumberOfFailures()
);
+        Assert.assertEquals( "wrong number of skipped", skipped, actualSuite.getNumberOfSkipped()
);
+    }
+}

Added: maven/surefire/trunk/surefire-integration-tests/src/test/resources/default-configuration/pom.xml
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/resources/default-configuration/pom.xml?rev=596385&view=auto
==============================================================================
--- maven/surefire/trunk/surefire-integration-tests/src/test/resources/default-configuration/pom.xml
(added)
+++ maven/surefire/trunk/surefire-integration-tests/src/test/resources/default-configuration/pom.xml
Mon Nov 19 10:05:14 2007
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+
+<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>org.apache.maven.plugins.surefire</groupId>
+  <artifactId>default-configuration</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  <name>Test for default configuration</name>
+  <description>Test for default surefire configuration</description>
+
+  <dependencies>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>3.8.1</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+
+</project>

Added: maven/surefire/trunk/surefire-integration-tests/src/test/resources/default-configuration/src/test/java/BasicTest.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/resources/default-configuration/src/test/java/BasicTest.java?rev=596385&view=auto
==============================================================================
--- maven/surefire/trunk/surefire-integration-tests/src/test/resources/default-configuration/src/test/java/BasicTest.java
(added)
+++ maven/surefire/trunk/surefire-integration-tests/src/test/resources/default-configuration/src/test/java/BasicTest.java
Mon Nov 19 10:05:14 2007
@@ -0,0 +1,66 @@
+import junit.extensions.TestSetup;
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+public class BasicTest
+    extends TestCase
+{
+
+    private boolean setUpCalled = false;
+
+    private static boolean tearDownCalled = false;
+
+    public BasicTest( String name, String extraName )
+    {
+        super( name );
+    }
+
+    public static Test suite()
+    {
+        TestSuite suite = new TestSuite();
+        Test test = new BasicTest( "testSetUp", "dummy" );
+        suite.addTest( test );
+        TestSetup setup = new TestSetup( suite )
+        {
+
+            protected void setUp()
+            {
+                //oneTimeSetUp();
+            }
+
+            protected void tearDown()
+            {
+                oneTimeTearDown();
+            }
+
+        };
+
+        return setup;
+    }
+
+    protected void setUp()
+    {
+        setUpCalled = true;
+        tearDownCalled = false;
+        System.out.println( "Called setUp" );
+    }
+
+    protected void tearDown()
+    {
+        setUpCalled = false;
+        tearDownCalled = true;
+        System.out.println( "Called tearDown" );
+    }
+
+    public void testSetUp()
+    {
+        assertTrue( "setUp was not called", setUpCalled );
+    }
+
+    public static void oneTimeTearDown()
+    {
+        assertTrue( "tearDown was not called", tearDownCalled );
+    }
+
+}



Mime
View raw message