maven-surefire-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dfabul...@apache.org
Subject svn commit: r597569 - in /maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its: HelperAssertions.java ITSuiteResults.java TestNgVersionsTest.java TwoTestCasesTest.java
Date Fri, 23 Nov 2007 06:28:47 GMT
Author: dfabulich
Date: Thu Nov 22 22:28:46 2007
New Revision: 597569

URL: http://svn.apache.org/viewvc?rev=597569&view=rev
Log:
Fix for two test cases IT; don't just read the first report, but sum results from all reports.

Added:
    maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ITSuiteResults.java
Modified:
    maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/HelperAssertions.java
    maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/TestNgVersionsTest.java
    maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/TwoTestCasesTest.java

Modified: maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/HelperAssertions.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/HelperAssertions.java?rev=597569&r1=597568&r2=597569&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/HelperAssertions.java
(original)
+++ maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/HelperAssertions.java
Thu Nov 22 22:28:46 2007
@@ -12,21 +12,21 @@
 public class HelperAssertions
 {
     public static void assertTestSuiteResults( int total, int errors, int failures, int skipped,
-                                               ReportTestSuite actualSuite )
+                                               ITSuiteResults actualSuite )
     {
-        Assert.assertEquals( "wrong number of tests", total, actualSuite.getNumberOfTests()
);
-        Assert.assertEquals( "wrong number of errors", errors, actualSuite.getNumberOfErrors()
);
-        Assert.assertEquals( "wrong number of failures", failures, actualSuite.getNumberOfFailures()
);
-        Assert.assertEquals( "wrong number of skipped", skipped, actualSuite.getNumberOfSkipped()
);
+        Assert.assertEquals( "wrong number of tests", total, actualSuite.getTotal() );
+        Assert.assertEquals( "wrong number of errors", errors, actualSuite.getErrors() );
+        Assert.assertEquals( "wrong number of failures", failures, actualSuite.getFailures()
);
+        Assert.assertEquals( "wrong number of skipped", skipped, actualSuite.getSkipped()
);
     }
     
     public static void assertTestSuiteResults( int total, int errors, int failures, int skipped,
                                                File testDir ) throws MavenReportException
{
-        ReportTestSuite suite = parseTestResults( testDir );
+        ITSuiteResults suite = parseTestResults( testDir );
         assertTestSuiteResults( total, errors, failures, skipped, suite );
     }
 
-    public static ReportTestSuite parseTestResults( File testDir )
+    public static ITSuiteResults parseTestResults( File testDir )
         throws MavenReportException
     {
         SurefireReportParser parser = new SurefireReportParser();
@@ -40,7 +40,15 @@
             throw new RuntimeException("Couldn't parse XML reports: " + reportsDir.getAbsolutePath(),
e);
         }
         Assert.assertTrue( "No reports!", reports.size() > 0 );
-        ReportTestSuite suite = (ReportTestSuite) reports.get( 0 );
-        return suite;
+        int total = 0, errors = 0, failures = 0, skipped = 0;
+        for (int i = 0; i < reports.size(); i++) {
+            ReportTestSuite suite = (ReportTestSuite) reports.get( 0 );
+            total += suite.getNumberOfTests();
+            errors += suite.getNumberOfErrors();
+            failures += suite.getNumberOfFailures();
+            skipped += suite.getNumberOfSkipped();
+        }
+        ITSuiteResults results = new ITSuiteResults(total, errors, failures, skipped);
+        return results;
     }
 }

Added: maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ITSuiteResults.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ITSuiteResults.java?rev=597569&view=auto
==============================================================================
--- maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ITSuiteResults.java
(added)
+++ maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ITSuiteResults.java
Thu Nov 22 22:28:46 2007
@@ -0,0 +1,55 @@
+package org.apache.maven.surefire.its;
+
+public class ITSuiteResults
+{
+    private int total, errors, failures, skipped;
+
+    public ITSuiteResults( int total, int errors, int failures, int skipped )
+    {
+        this.total = total;
+        this.errors = errors;
+        this.failures = failures;
+        this.skipped = skipped;
+    }
+
+    public int getTotal()
+    {
+        return total;
+    }
+
+    public void setTotal( int total )
+    {
+        this.total = total;
+    }
+
+    public int getErrors()
+    {
+        return errors;
+    }
+
+    public void setErrors( int errors )
+    {
+        this.errors = errors;
+    }
+
+    public int getFailures()
+    {
+        return failures;
+    }
+
+    public void setFailures( int failures )
+    {
+        this.failures = failures;
+    }
+
+    public int getSkipped()
+    {
+        return skipped;
+    }
+
+    public void setSkipped( int skipped )
+    {
+        this.skipped = skipped;
+    }
+    
+}

Modified: maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/TestNgVersionsTest.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/TestNgVersionsTest.java?rev=597569&r1=597568&r2=597569&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/TestNgVersionsTest.java
(original)
+++ maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/TestNgVersionsTest.java
Thu Nov 22 22:28:46 2007
@@ -74,7 +74,7 @@
         verifier.verifyErrorFreeLog();
         verifier.resetStreams();
         
-        ReportTestSuite suite = HelperAssertions.parseTestResults( testDir );
+        ITSuiteResults suite = HelperAssertions.parseTestResults( testDir );
         HelperAssertions.assertTestSuiteResults( 1, 0, 0, 0, suite );
     }
 }

Modified: maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/TwoTestCasesTest.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/TwoTestCasesTest.java?rev=597569&r1=597568&r2=597569&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/TwoTestCasesTest.java
(original)
+++ maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/TwoTestCasesTest.java
Thu Nov 22 22:28:46 2007
@@ -7,7 +7,7 @@
 import org.apache.maven.it.util.ResourceExtractor;
 
 /**
- * Test basic default configuration, runs the JUnit 3 test in the src/test directory.
+ * Test running two test cases; confirms reporting works correctly
  * 
  * @author <a href="mailto:dfabulich@apache.org">Dan Fabulich</a>
  * 
@@ -15,7 +15,7 @@
 public class TwoTestCasesTest
     extends AbstractMavenIntegrationTestCase
 {
-    public void testDefaultConfiguration ()
+    public void testTwoTestCases ()
         throws Exception
     {
         File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/junit-twoTestCases"
);



Mime
View raw message