Repository: maven-surefire
Updated Branches:
  refs/heads/master 175d1d44b -> d60225741


[SUREFIRE-1252] Tests not being run when using XML suite file with TestNG


Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/d6022574
Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/d6022574
Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/d6022574

Branch: refs/heads/master
Commit: d60225741a8d65d9109d3bd28d3d019c19f120cb
Parents: 175d1d4
Author: Tibor17 <tibo...@lycos.com>
Authored: Tue Sep 20 00:57:06 2016 +0200
Committer: Tibor17 <tibo...@lycos.com>
Committed: Tue Sep 20 00:57:06 2016 +0200

----------------------------------------------------------------------
 .../org/apache/maven/surefire/testng/TestNGProvider.java | 11 +++++++++--
 .../apache/maven/surefire/testng/TestNGXmlTestSuite.java |  7 +++++--
 2 files changed, 14 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/d6022574/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGProvider.java
----------------------------------------------------------------------
diff --git 
a/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGProvider.java
 
b/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGProvider.java
index f78dad8..56f98de 100644
--- 
a/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGProvider.java
+++ 
b/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGProvider.java
@@ -40,7 +40,6 @@ import org.apache.maven.surefire.util.TestsToRun;
 
 import java.io.File;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.List;
 import java.util.Map;
 
@@ -207,11 +206,19 @@ public class TestNGProvider
                                        
reporterConfiguration.getReportsDirectory(), getSkipAfterFailureCount() );
     }
 
+    @SuppressWarnings( "unchecked" )
     public Iterable<Class<?>> getSuites()
     {
         if ( isTestNGXmlTestSuite( testRequest ) )
         {
-            return Collections.emptySet();
+            try
+            {
+                return newXmlSuite().locateTestSets();
+            }
+            catch ( TestSetFailedException e )
+            {
+                throw new RuntimeException( e );
+            }
         }
         else
         {

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/d6022574/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGXmlTestSuite.java
----------------------------------------------------------------------
diff --git 
a/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGXmlTestSuite.java
 
b/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGXmlTestSuite.java
index 03bc55b..c8abd60 100644
--- 
a/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGXmlTestSuite.java
+++ 
b/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGXmlTestSuite.java
@@ -76,7 +76,7 @@ final class TestNGXmlTestSuite
         finishTestSuite( reporter );
     }
 
-    void locateTestSets()
+    Iterable locateTestSets()
         throws TestSetFailedException
     {
         if ( suiteFilePaths != null )
@@ -89,7 +89,8 @@ final class TestNGXmlTestSuite
             throw new IllegalStateException( "No suite files were specified" );
         }
 
-        suiteFilePaths = new ArrayList<String>();
+        suiteFilePaths = new ArrayList<String>( suiteFiles.size() );
+        ArrayList<File> testSets = new ArrayList<File>( suiteFiles.size() );
 
         for ( File suiteFile : suiteFiles )
         {
@@ -97,8 +98,10 @@ final class TestNGXmlTestSuite
             {
                 throw new TestSetFailedException( "Suite file " + suiteFile + 
" is not a valid file" );
             }
+            testSets.add( suiteFile );
             suiteFilePaths.add( suiteFile.getAbsolutePath() );
         }
+        return testSets;
     }
 
     @Override

Reply via email to