maven-surefire-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dfabul...@apache.org
Subject svn commit: r628192 - in /maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng: TestNGDirectoryTestSuite.java TestNGXmlTestSuite.java
Date Fri, 15 Feb 2008 22:28:34 GMT
Author: dfabulich
Date: Fri Feb 15 14:28:34 2008
New Revision: 628192

URL: http://svn.apache.org/viewvc?rev=628192&view=rev
Log:
[SUREFIRE-452] Allow the user to override the name "TestSuite" in plugin configuration.  I
modified this patch to make it work with XML suites as well.
Submitted by: Erez Nahir
Reviewed by: Dan Fabulich

Modified:
    maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGDirectoryTestSuite.java
    maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGXmlTestSuite.java

Modified: maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGDirectoryTestSuite.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGDirectoryTestSuite.java?rev=628192&r1=628191&r2=628192&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGDirectoryTestSuite.java
(original)
+++ maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGDirectoryTestSuite.java
Fri Feb 15 14:28:34 2008
@@ -74,6 +74,7 @@
         this.version = artifactVersion;
         
         this.classifier = artifactClassifier;
+
     }
 
     protected SurefireTestSet createTestSet( Class testClass, ClassLoader classLoader )
@@ -161,8 +162,8 @@
     public static void startTestSuite( ReporterManager reporterManager, Object suite )
     {
         String rawString = bundle.getString( "testSetStarting" );
-
-        ReportEntry report = new ReportEntry( suite.getClass().getName(), "TestSuite", rawString
);
+        
+        ReportEntry report = new ReportEntry( suite.getClass().getName(), getSuiteName(suite),
rawString );
 
         try
         {
@@ -179,10 +180,32 @@
         String rawString = bundle.getString( "testSetCompletedNormally" );
 
         ReportEntry report =
-            new ReportEntry( suite.getClass().getName(), "TestSuite", rawString );
+            new ReportEntry( suite.getClass().getName(), getSuiteName(suite), rawString );
 
         reporterManager.testSetCompleted( report );
 
         reporterManager.reset();
     }
+    
+    public String getSuiteName() {
+        String result = (String) options.get("suitename");
+        if (result == null) {
+            result = "TestSuite";
+        }
+        return result;
+    }
+
+    private static String getSuiteName(Object suite)
+    {
+        String result;
+        if (suite instanceof TestNGDirectoryTestSuite) {
+            return ((TestNGDirectoryTestSuite) suite).getSuiteName();
+        } else if (suite instanceof TestNGXmlTestSuite) {
+            return ((TestNGXmlTestSuite) suite).getSuiteName();
+        }else {
+            result = "TestSuite";
+        }
+
+        return result;
+    }    
 }

Modified: maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGXmlTestSuite.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGXmlTestSuite.java?rev=628192&r1=628191&r2=628192&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGXmlTestSuite.java
(original)
+++ maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGXmlTestSuite.java
Fri Feb 15 14:28:34 2008
@@ -134,4 +134,12 @@
 
         return this.testSets;
     }
+    
+    public String getSuiteName() {
+        String result = (String) options.get("suitename");
+        if (result == null) {
+            result = "TestSuite";
+        }
+        return result;
+    }
 }



Mime
View raw message