Author: krosenvold
Date: Mon Dec  5 19:34:37 2011
New Revision: 1210590

URL: http://svn.apache.org/viewvc?rev=1210590&view=rev
Log:
[SUREFIRE-805] Regression: surefire 2.11 seems to break excludeGroups config 
with TestNG

Fixed in r1210583, this commit adds integration test.

Added:
    
maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/TestNgGroupsIT.java
   (with props)
    
maven/surefire/trunk/surefire-integration-tests/src/test/resources/testng-groups/
    
maven/surefire/trunk/surefire-integration-tests/src/test/resources/testng-groups/pom.xml
   (with props)
    
maven/surefire/trunk/surefire-integration-tests/src/test/resources/testng-groups/src/
    
maven/surefire/trunk/surefire-integration-tests/src/test/resources/testng-groups/src/test/
    
maven/surefire/trunk/surefire-integration-tests/src/test/resources/testng-groups/src/test/java/
    
maven/surefire/trunk/surefire-integration-tests/src/test/resources/testng-groups/src/test/java/testng/
    
maven/surefire/trunk/surefire-integration-tests/src/test/resources/testng-groups/src/test/java/testng/jdk14/
    
maven/surefire/trunk/surefire-integration-tests/src/test/resources/testng-groups/src/test/java/testng/jdk14/TestNGJavadocTest.java
   (with props)
Modified:
    
maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/SurefireVerifierTestClass.java

Modified: 
maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/SurefireVerifierTestClass.java
URL: 
http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/SurefireVerifierTestClass.java?rev=1210590&r1=1210589&r2=1210590&view=diff
==============================================================================
--- 
maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/SurefireVerifierTestClass.java
 (original)
+++ 
maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/SurefireVerifierTestClass.java
 Mon Dec  5 19:34:37 2011
@@ -424,5 +424,11 @@ public abstract class SurefireVerifierTe
         addGoal( "-D" + variable + "=" + value);
     }
 
+    public void setGroups(String groups){
+        addD( "groups", groups );
+    }
+    public void setExcludedGroups(String excludedGroups){
+        addD( "excludedGroups", excludedGroups );
+    }
 
 }

Added: 
maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/TestNgGroupsIT.java
URL: 
http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/TestNgGroupsIT.java?rev=1210590&view=auto
==============================================================================
--- 
maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/TestNgGroupsIT.java
 (added)
+++ 
maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/TestNgGroupsIT.java
 Mon Dec  5 19:34:37 2011
@@ -0,0 +1,53 @@
+package org.apache.maven.surefire.its;
+/*
+ * 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.
+ */
+
+
+/**
+ * Test that TestNG's @Test(threadPoolSize = n, invocationCount=n) causes 
tests to be run in parallel.
+ * 
+ * @author <a href="mailto:spam.hai...@gmail.com";>Haikal Saadh</a>
+ * 
+ */
+public class TestNgGroupsIT
+   extends SurefireVerifierTestClass
+{
+    public TestNgGroupsIT()
+    {
+        super( "/testng-groups" );
+    }
+
+    public void testTestNgGroupThreadParallel ()
+        throws Exception
+    {
+        setExcludedGroups( "notincluded" );
+        executeTest();
+        verifyErrorFreeLog();
+        assertTestSuiteResults( 1, 0, 0, 0 );
+    }
+    public void testGroups()
+        throws Exception
+    {
+        setGroups( "functional" );
+        executeTest();
+        verifyErrorFreeLog();
+        assertTestSuiteResults( 2, 0, 0, 0 );
+    }
+
+}

Propchange: 
maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/TestNgGroupsIT.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
maven/surefire/trunk/surefire-integration-tests/src/test/resources/testng-groups/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/resources/testng-groups/pom.xml?rev=1210590&view=auto
==============================================================================
--- 
maven/surefire/trunk/surefire-integration-tests/src/test/resources/testng-groups/pom.xml
 (added)
+++ 
maven/surefire/trunk/surefire-integration-tests/src/test/resources/testng-groups/pom.xml
 Mon Dec  5 19:34:37 2011
@@ -0,0 +1,58 @@
+<?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>testng-groups</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  <name>Test for testng groups</name>
+
+  <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.7</version>
+      <classifier>jdk14</classifier>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <testSourceDirectory>src/test/java</testSourceDirectory>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <version>${surefire.version}</version>
+      </plugin>
+    </plugins>
+  </build>
+
+</project>

Propchange: 
maven/surefire/trunk/surefire-integration-tests/src/test/resources/testng-groups/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
maven/surefire/trunk/surefire-integration-tests/src/test/resources/testng-groups/src/test/java/testng/jdk14/TestNGJavadocTest.java
URL: 
http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/resources/testng-groups/src/test/java/testng/jdk14/TestNGJavadocTest.java?rev=1210590&view=auto
==============================================================================
--- 
maven/surefire/trunk/surefire-integration-tests/src/test/resources/testng-groups/src/test/java/testng/jdk14/TestNGJavadocTest.java
 (added)
+++ 
maven/surefire/trunk/surefire-integration-tests/src/test/resources/testng-groups/src/test/java/testng/jdk14/TestNGJavadocTest.java
 Mon Dec  5 19:34:37 2011
@@ -0,0 +1,55 @@
+package testng.jdk14;
+
+import org.testng.Assert;
+
+
+/**
+ * Tests that forcing testng to run tests via the 
<code>"${maven.test.forcetestng}"</code>
+ * configuration option works.
+ *
+ * @author jkuhnert
+ */
+public class TestNGJavadocTest
+{
+
+    /**
+     * Sets up testObject
+     *
+     * @testng.configuration beforeTestClass = "true" groups = "functional"
+     */
+    public void configureTest()
+    {
+        testObject = new Object();
+    }
+
+    Object testObject;
+
+    /**
+     * Tests reporting an error
+     *
+     * @testng.test groups = "functional, notincluded"
+     */
+    public void isTestObjectNull()
+    {
+        Assert.assertNotNull( testObject, "testObject is null" );
+    }
+
+    /**
+     * Sample method that shouldn't be run by test suite.
+     *
+     * @testng.test groups = "notincluded"
+     */
+    public void shouldNotRun()
+    {
+        Assert.assertTrue( false, "Group specified by test shouldnt be run." );
+    }
+
+    /**
+     * Sample method that shouldn't be run by test suite.
+     * @testng.test groups = "functional"
+     */
+    public void noGroup()
+    {
+    }
+
+}

Propchange: 
maven/surefire/trunk/surefire-integration-tests/src/test/resources/testng-groups/src/test/java/testng/jdk14/TestNGJavadocTest.java
------------------------------------------------------------------------------
    svn:eol-style = native


Reply via email to