You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by fg...@apache.org on 2006/08/31 14:41:42 UTC

svn commit: r438896 - in /maven/plugins/trunk/maven-surefire-plugin/src: it/ it/test3/ it/test4/ it/test4/src/test-data/ it/test4/src/test/java/ it/test5/ it/test6/ it/test6/src/test/java/ it/test7/ it/test7/src/ it/test7/src/test/ it/test7/src/test/ja...

Author: fgiust
Date: Thu Aug 31 05:41:41 2006
New Revision: 438896

URL: http://svn.apache.org/viewvc?rev=438896&view=rev
Log:
PR: MSUREFIRE-134 Surefire finds test classes but ignores test methods and configuration methods with TestNG and includes tag
Submitted by: Jesse Kuhnert
Reviewed by: Fabrizio Giustina

Added:
    maven/plugins/trunk/maven-surefire-plugin/src/it/test7/
    maven/plugins/trunk/maven-surefire-plugin/src/it/test7/pom.xml   (with props)
    maven/plugins/trunk/maven-surefire-plugin/src/it/test7/src/
    maven/plugins/trunk/maven-surefire-plugin/src/it/test7/src/test/
    maven/plugins/trunk/maven-surefire-plugin/src/it/test7/src/test/java/
    maven/plugins/trunk/maven-surefire-plugin/src/it/test7/src/test/java/JunitTest.java   (with props)
    maven/plugins/trunk/maven-surefire-plugin/src/it/test7/src/test/java/TestNGJunitTest.java   (with props)
Removed:
    maven/plugins/trunk/maven-surefire-plugin/src/it/test6/src/test/java/JunitTest.java
Modified:
    maven/plugins/trunk/maven-surefire-plugin/src/it/pom.xml
    maven/plugins/trunk/maven-surefire-plugin/src/it/test3/pom.xml
    maven/plugins/trunk/maven-surefire-plugin/src/it/test4/pom.xml
    maven/plugins/trunk/maven-surefire-plugin/src/it/test4/src/test-data/testng.xml
    maven/plugins/trunk/maven-surefire-plugin/src/it/test4/src/test/java/TestNGSuiteTest.java
    maven/plugins/trunk/maven-surefire-plugin/src/it/test5/pom.xml
    maven/plugins/trunk/maven-surefire-plugin/src/it/test6/pom.xml
    maven/plugins/trunk/maven-surefire-plugin/src/it/test6/src/test/java/TestNGTest.java
    maven/plugins/trunk/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java

Modified: maven/plugins/trunk/maven-surefire-plugin/src/it/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-surefire-plugin/src/it/pom.xml?rev=438896&r1=438895&r2=438896&view=diff
==============================================================================
--- maven/plugins/trunk/maven-surefire-plugin/src/it/pom.xml (original)
+++ maven/plugins/trunk/maven-surefire-plugin/src/it/pom.xml Thu Aug 31 05:41:41 2006
@@ -14,6 +14,9 @@
     <module>test1</module>
     <module>test2</module>
     <module>test3</module>
+    <module>test4</module>
+    <module>test5</module>
+    <module>test6</module>
   </modules> 
 
 </project>

Modified: maven/plugins/trunk/maven-surefire-plugin/src/it/test3/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-surefire-plugin/src/it/test3/pom.xml?rev=438896&r1=438895&r2=438896&view=diff
==============================================================================
--- maven/plugins/trunk/maven-surefire-plugin/src/it/test3/pom.xml (original)
+++ maven/plugins/trunk/maven-surefire-plugin/src/it/test3/pom.xml Thu Aug 31 05:41:41 2006
@@ -24,7 +24,7 @@
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-surefire-plugin</artifactId>
-        <version>2.1.2</version>
+        <version>2.1</version>
         <configuration>
           <testFailureIgnore>true</testFailureIgnore >
         </configuration>

Modified: maven/plugins/trunk/maven-surefire-plugin/src/it/test4/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-surefire-plugin/src/it/test4/pom.xml?rev=438896&r1=438895&r2=438896&view=diff
==============================================================================
--- maven/plugins/trunk/maven-surefire-plugin/src/it/test4/pom.xml (original)
+++ maven/plugins/trunk/maven-surefire-plugin/src/it/test4/pom.xml Thu Aug 31 05:41:41 2006
@@ -12,15 +12,10 @@
    
    <dependencies>
       <dependency>
-         <groupId>junit</groupId>
-         <artifactId>junit</artifactId>
-         <version>3.8.1</version>
-         <scope>test</scope>
-      </dependency>
-      <dependency>
          <groupId>org.testng</groupId>
-         <artifactId>testng-jdk15</artifactId>
-         <version>4.4.7</version>
+         <artifactId>testng</artifactId>
+         <version>5.0.1</version>
+         <classifier>jdk15</classifier>
          <scope>test</scope>
       </dependency>
    </dependencies>
@@ -46,5 +41,6 @@
          </plugin>
       </plugins>
    </build>
-
+   
+    
 </project>

Modified: maven/plugins/trunk/maven-surefire-plugin/src/it/test4/src/test-data/testng.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-surefire-plugin/src/it/test4/src/test-data/testng.xml?rev=438896&r1=438895&r2=438896&view=diff
==============================================================================
--- maven/plugins/trunk/maven-surefire-plugin/src/it/test4/src/test-data/testng.xml (original)
+++ maven/plugins/trunk/maven-surefire-plugin/src/it/test4/src/test-data/testng.xml Thu Aug 31 05:41:41 2006
@@ -1,8 +1,8 @@
 <!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
  
-<suite name="Suite 1 Test" verbose="1" >
+<suite name="Suite 1 Test" verbose="4" >
 
-  <test name="Sample Test"  >
+  <test name="Sample Test" >
     <classes>
       <class name="TestNGSuiteTest"  />
     </classes>

Modified: maven/plugins/trunk/maven-surefire-plugin/src/it/test4/src/test/java/TestNGSuiteTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-surefire-plugin/src/it/test4/src/test/java/TestNGSuiteTest.java?rev=438896&r1=438895&r2=438896&view=diff
==============================================================================
--- maven/plugins/trunk/maven-surefire-plugin/src/it/test4/src/test/java/TestNGSuiteTest.java (original)
+++ maven/plugins/trunk/maven-surefire-plugin/src/it/test4/src/test/java/TestNGSuiteTest.java Thu Aug 31 05:41:41 2006
@@ -1,6 +1,5 @@
-import org.testng.annotations.Configuration;
+import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
-import org.testng.internal.Utils;
 
 
 /**
@@ -15,7 +14,7 @@
 	/**
 	 * Sets up testObject
 	 */
-	@Configuration(beforeTestClass = true)
+	@BeforeClass
 	public void configureTest()
 	{
 		testObject = new Object();

Modified: maven/plugins/trunk/maven-surefire-plugin/src/it/test5/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-surefire-plugin/src/it/test5/pom.xml?rev=438896&r1=438895&r2=438896&view=diff
==============================================================================
--- maven/plugins/trunk/maven-surefire-plugin/src/it/test5/pom.xml (original)
+++ maven/plugins/trunk/maven-surefire-plugin/src/it/test5/pom.xml Thu Aug 31 05:41:41 2006
@@ -19,8 +19,9 @@
       </dependency>
       <dependency>
          <groupId>org.testng</groupId>
-         <artifactId>testng-jdk14</artifactId>
-         <version>4.4.7</version>
+         <artifactId>testng</artifactId>
+         <version>5.0.1</version>
+         <classifier>jdk14</classifier>
          <scope>test</scope>
       </dependency>
    </dependencies>

Modified: maven/plugins/trunk/maven-surefire-plugin/src/it/test6/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-surefire-plugin/src/it/test6/pom.xml?rev=438896&r1=438895&r2=438896&view=diff
==============================================================================
--- maven/plugins/trunk/maven-surefire-plugin/src/it/test6/pom.xml (original)
+++ maven/plugins/trunk/maven-surefire-plugin/src/it/test6/pom.xml Thu Aug 31 05:41:41 2006
@@ -7,20 +7,15 @@
    <groupId>org.apache.maven.plugins.surefire</groupId>
    <artifactId>test6</artifactId>
    <version>1.0-SNAPSHOT</version>
-   <name>Test for testng integration</name>
-   <description>calls testng test</description>
+   <name>TestNG group/parallel thread tests</name>
+   <description>Tests group/thread/parallel functionality of TestNG</description>
    
    <dependencies>
       <dependency>
-         <groupId>junit</groupId>
-         <artifactId>junit</artifactId>
-         <version>3.8.1</version>
-         <scope>test</scope>
-      </dependency>
-      <dependency>
          <groupId>org.testng</groupId>
-         <artifactId>testng-jdk15</artifactId>
-         <version>4.4.7</version>
+         <artifactId>testng</artifactId>
+         <version>5.0.1</version>
+         <classifier>jdk15</classifier>
          <scope>test</scope>
       </dependency>
    </dependencies>

Modified: maven/plugins/trunk/maven-surefire-plugin/src/it/test6/src/test/java/TestNGTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-surefire-plugin/src/it/test6/src/test/java/TestNGTest.java?rev=438896&r1=438895&r2=438896&view=diff
==============================================================================
--- maven/plugins/trunk/maven-surefire-plugin/src/it/test6/src/test/java/TestNGTest.java (original)
+++ maven/plugins/trunk/maven-surefire-plugin/src/it/test6/src/test/java/TestNGTest.java Thu Aug 31 05:41:41 2006
@@ -1,26 +1,34 @@
-import org.testng.annotations.Configuration;
+import org.testng.annotations.AfterSuite;
+import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
-import org.testng.internal.Utils;
 
 
 /**
- * Tests that forcing testng to run tests via the 
- * <code>"${maven.test.forcetestng}"</code> configuration option
- * works.
+ * Tests grouping/threading/parallel functionality of TestNG.
  * 
  * @author jkuhnert
  */
 public class TestNGTest {
 
+	static int m_testCount = 0;
+	
 	/**
 	 * Sets up testObject
 	 */
-	@Configuration(beforeTestClass = true, groups = "functional")
+	@BeforeClass(groups = "functional")
 	public void configureTest()
 	{
 		testObject = new Object();
 	}
 	
+	@AfterSuite(alwaysRun = true, groups = "functional")
+	public void check_Test_Count()
+	{
+		System.out.println("check_Test_Count(): " + m_testCount);
+		
+		assert m_testCount == 3 : "Expected 3 tests to be run but local count was " + m_testCount;
+	}
+	
 	Object testObject;
 	
 	/**
@@ -29,6 +37,7 @@
 	@Test(groups = {"functional", "notincluded"})
 	public void isTestObjectNull()
 	{
+		m_testCount++;
 		assert testObject != null : "testObject is null";
 	}
 	

Added: maven/plugins/trunk/maven-surefire-plugin/src/it/test7/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-surefire-plugin/src/it/test7/pom.xml?rev=438896&view=auto
==============================================================================
--- maven/plugins/trunk/maven-surefire-plugin/src/it/test7/pom.xml (added)
+++ maven/plugins/trunk/maven-surefire-plugin/src/it/test7/pom.xml Thu Aug 31 05:41:41 2006
@@ -0,0 +1,46 @@
+<?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>test7</artifactId>
+   <version>1.0-SNAPSHOT</version>
+   <name>TestNG Junit Compatible</name>
+   <description>Tests that junit tests can be executed alongside TestNG tests</description>
+   
+   <dependencies>
+      <dependency>
+         <groupId>junit</groupId>
+         <artifactId>junit</artifactId>
+         <version>3.8.1</version>
+         <scope>test</scope>
+      </dependency>
+      <dependency>
+         <groupId>org.testng</groupId>
+         <artifactId>testng</artifactId>
+         <version>5.0.1</version>
+         <classifier>jdk15</classifier>
+         <scope>test</scope>
+      </dependency>
+   </dependencies>
+   
+   <build>
+      <plugins>
+         <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-surefire-plugin</artifactId>
+         </plugin>
+         <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-compiler-plugin</artifactId>
+            <configuration>
+               <source>1.5</source>
+               <target>1.5</target>
+            </configuration>
+         </plugin>
+      </plugins>
+   </build>
+
+</project>

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

Propchange: maven/plugins/trunk/maven-surefire-plugin/src/it/test7/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: maven/plugins/trunk/maven-surefire-plugin/src/it/test7/src/test/java/JunitTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-surefire-plugin/src/it/test7/src/test/java/JunitTest.java?rev=438896&view=auto
==============================================================================
--- maven/plugins/trunk/maven-surefire-plugin/src/it/test7/src/test/java/JunitTest.java (added)
+++ maven/plugins/trunk/maven-surefire-plugin/src/it/test7/src/test/java/JunitTest.java Thu Aug 31 05:41:41 2006
@@ -0,0 +1,28 @@
+import junit.framework.TestCase;
+
+/**
+ * Provided to ensure both junit and testng tests can run together.
+ * 
+ * @author jkuhnert
+ */
+public class JunitTest extends TestCase {
+
+	Object testObject;
+	
+	/**
+	 * Creats an object instance
+	 */
+	public void setUp()
+	{
+		testObject = new Object();
+	}
+	
+	/**
+	 * Tests that object created in setup 
+	 * isn't null.
+	 */
+	public void testJunitObject()
+	{
+		assertNotNull(testObject);
+	}
+}

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

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

Propchange: maven/plugins/trunk/maven-surefire-plugin/src/it/test7/src/test/java/JunitTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: maven/plugins/trunk/maven-surefire-plugin/src/it/test7/src/test/java/TestNGJunitTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-surefire-plugin/src/it/test7/src/test/java/TestNGJunitTest.java?rev=438896&view=auto
==============================================================================
--- maven/plugins/trunk/maven-surefire-plugin/src/it/test7/src/test/java/TestNGJunitTest.java (added)
+++ maven/plugins/trunk/maven-surefire-plugin/src/it/test7/src/test/java/TestNGJunitTest.java Thu Aug 31 05:41:41 2006
@@ -0,0 +1,31 @@
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+
+/**
+ * Simple test
+ * 
+ * @author jkuhnert
+ */
+public class TestNGJunitTest {
+
+	/**
+	 * Sets up testObject
+	 */
+	@BeforeClass
+	public void configureTest()
+	{
+		testObject = new Object();
+	}
+	
+	Object testObject;
+	
+	/**
+	 * Tests reporting an error
+	 */
+	@Test
+	public void isTestObjectNull()
+	{
+		assert testObject != null : "testObject is null";
+	}
+}

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

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

Propchange: maven/plugins/trunk/maven-surefire-plugin/src/it/test7/src/test/java/TestNGJunitTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: maven/plugins/trunk/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java?rev=438896&r1=438895&r2=438896&view=diff
==============================================================================
--- maven/plugins/trunk/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java (original)
+++ maven/plugins/trunk/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java Thu Aug 31 05:41:41 2006
@@ -457,6 +457,8 @@
 
             if ( testNgArtifact != null )
             {
+                addArtifact(surefireBooter, testNgArtifact);
+
                 VersionRange range = VersionRange.createFromVersionSpec( "[4.7,)" );
                 if ( !range.containsVersion( testNgArtifact.getSelectedVersion() ) )
                 {