You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ca...@apache.org on 2006/01/03 16:51:50 UTC

svn commit: r365666 - in /maven/plugins/trunk/maven-surefire-plugin/src/it: test1/pom.xml test1/src/test/java/SurefireTest.java test2/pom.xml test2/src/test/java/SurefireTest.java

Author: carlos
Date: Tue Jan  3 07:51:39 2006
New Revision: 365666

URL: http://svn.apache.org/viewcvs?rev=365666&view=rev
Log:
Added more tests

Added:
    maven/plugins/trunk/maven-surefire-plugin/src/it/test2/pom.xml   (with props)
    maven/plugins/trunk/maven-surefire-plugin/src/it/test2/src/test/java/SurefireTest.java   (with props)
Modified:
    maven/plugins/trunk/maven-surefire-plugin/src/it/test1/pom.xml
    maven/plugins/trunk/maven-surefire-plugin/src/it/test1/src/test/java/SurefireTest.java

Modified: maven/plugins/trunk/maven-surefire-plugin/src/it/test1/pom.xml
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-surefire-plugin/src/it/test1/pom.xml?rev=365666&r1=365665&r2=365666&view=diff
==============================================================================
--- maven/plugins/trunk/maven-surefire-plugin/src/it/test1/pom.xml (original)
+++ maven/plugins/trunk/maven-surefire-plugin/src/it/test1/pom.xml Tue Jan  3 07:51:39 2006
@@ -7,8 +7,8 @@
   <groupId>org.apache.maven.plugins.surefire</groupId>
   <artifactId>test1</artifactId>
   <version>1.0-SNAPSHOT</version>
-  <name>Test for MSUREFIRE-20</name>
-  <description>forkMode=pertest fails to call setUp</description>
+  <name>Test for default configuration</name>
+  <description>Test for default surefire configuration</description>
  
   <dependencies>
     <dependency>
@@ -18,17 +18,5 @@
       <scope>test</scope>
     </dependency>
   </dependencies>
-
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-surefire-plugin</artifactId>
-        <configuration>
-          <forkMode>pertest</forkMode>
-        </configuration>
-      </plugin>
-    </plugins>
-  </build>
 
 </project>

Modified: maven/plugins/trunk/maven-surefire-plugin/src/it/test1/src/test/java/SurefireTest.java
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-surefire-plugin/src/it/test1/src/test/java/SurefireTest.java?rev=365666&r1=365665&r2=365666&view=diff
==============================================================================
--- maven/plugins/trunk/maven-surefire-plugin/src/it/test1/src/test/java/SurefireTest.java (original)
+++ maven/plugins/trunk/maven-surefire-plugin/src/it/test1/src/test/java/SurefireTest.java Tue Jan  3 07:51:39 2006
@@ -1,19 +1,66 @@
+import junit.extensions.TestSetup;
+import junit.framework.Test;
 import junit.framework.TestCase;
+import junit.framework.TestSuite;
 
-public class SurefireTest extends TestCase {
-    
-	private boolean setupCalled = false;
-
-	protected void setUp() {
-		setupCalled = true;
-	}
-	
-	protected void tearDown() {
-		// is there a way to tests to see if tearDown was called?
-	}
-	
-	public void testSetup() {
-		assertTrue("Setup was not called", setupCalled);
-	}
+public class SurefireTest
+    extends TestCase
+{
+
+    private boolean setUpCalled = false;
+
+    private static boolean tearDownCalled = false;
+
+    public SurefireTest( String name, String extraName )
+    {
+        super( name );
+    }
+
+    public static Test suite()
+    {
+        TestSuite suite = new TestSuite();
+        Test test = new SurefireTest( "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 );
+    }
 
 }

Added: maven/plugins/trunk/maven-surefire-plugin/src/it/test2/pom.xml
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-surefire-plugin/src/it/test2/pom.xml?rev=365666&view=auto
==============================================================================
--- maven/plugins/trunk/maven-surefire-plugin/src/it/test2/pom.xml (added)
+++ maven/plugins/trunk/maven-surefire-plugin/src/it/test2/pom.xml Tue Jan  3 07:51:39 2006
@@ -0,0 +1,34 @@
+<?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>org.apache.maven.plugins.surefire</groupId>
+  <artifactId>test1</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  <name>Test for MSUREFIRE-20</name>
+  <description>forkMode=pertest fails to call setUp</description>
+ 
+  <dependencies>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>3.8.1</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <forkMode>pertest</forkMode>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
+</project>

Propchange: maven/plugins/trunk/maven-surefire-plugin/src/it/test2/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-surefire-plugin/src/it/test2/pom.xml
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/plugins/trunk/maven-surefire-plugin/src/it/test2/src/test/java/SurefireTest.java
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-surefire-plugin/src/it/test2/src/test/java/SurefireTest.java?rev=365666&view=auto
==============================================================================
--- maven/plugins/trunk/maven-surefire-plugin/src/it/test2/src/test/java/SurefireTest.java (added)
+++ maven/plugins/trunk/maven-surefire-plugin/src/it/test2/src/test/java/SurefireTest.java Tue Jan  3 07:51:39 2006
@@ -0,0 +1,66 @@
+import junit.extensions.TestSetup;
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+public class SurefireTest
+    extends TestCase
+{
+
+    private boolean setUpCalled = false;
+
+    private static boolean tearDownCalled = false;
+
+    public SurefireTest( String name, String extraName )
+    {
+        super( name );
+    }
+
+    public static Test suite()
+    {
+        TestSuite suite = new TestSuite();
+        Test test = new SurefireTest( "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 );
+    }
+
+}

Propchange: maven/plugins/trunk/maven-surefire-plugin/src/it/test2/src/test/java/SurefireTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-surefire-plugin/src/it/test2/src/test/java/SurefireTest.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"