maven-surefire-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r383011 - in /maven/surefire/branches/surefire-testng: surefire-api/src/main/java/org/apache/maven/surefire/report/ surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/
Date Sat, 04 Mar 2006 03:27:16 GMT
Author: brett
Date: Fri Mar  3 19:27:14 2006
New Revision: 383011

URL: http://svn.apache.org/viewcvs?rev=383011&view=rev
Log:
[MSUREFIRE-23] recognise skipped tests

Modified:
    maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractReporter.java
    maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractTextReporter.java
    maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/report/Reporter.java
    maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/report/ReporterManager.java
    maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/report/XMLReporter.java
    maven/surefire/branches/surefire-testng/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGReporter.java

Modified: maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractReporter.java
URL: http://svn.apache.org/viewcvs/maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractReporter.java?rev=383011&r1=383010&r2=383011&view=diff
==============================================================================
--- maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractReporter.java
(original)
+++ maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractReporter.java
Fri Mar  3 19:27:14 2006
@@ -45,6 +45,8 @@
 
     protected long testSetStartTime;
 
+    protected int skipped;
+
     // ----------------------------------------------------------------------
     // Report interface
     // ----------------------------------------------------------------------
@@ -93,6 +95,13 @@
         endTest();
     }
 
+    public void testSkipped( ReportEntry report )
+    {
+        ++skipped;
+
+        endTest();
+    }
+
     public void testError( ReportEntry report, String stdOut, String stdErr )
     {
         ++errors;
@@ -123,6 +132,11 @@
         return errors;
     }
 
+    public int getNumSkipped()
+    {
+        return skipped;
+    }
+
     public int getNumFailures()
     {
         return failures;
@@ -140,6 +154,8 @@
     public void reset()
     {
         errors = 0;
+
+        skipped = 0;
 
         failures = 0;
 

Modified: maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractTextReporter.java
URL: http://svn.apache.org/viewcvs/maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractTextReporter.java?rev=383011&r1=383010&r2=383011&view=diff
==============================================================================
--- maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractTextReporter.java
(original)
+++ maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractTextReporter.java
Fri Mar  3 19:27:14 2006
@@ -78,6 +78,16 @@
         }
     }
 
+    public void testSkipped( ReportEntry report )
+    {
+        super.testSkipped( report );
+
+        if ( PLAIN.equals( format ) )
+        {
+            testResults.add( report.getName() + " skipped" );
+        }
+    }
+
     public void testError( ReportEntry report, String stdOut, String stdErr )
     {
         super.testError( report, stdOut, stdErr );
@@ -125,6 +135,8 @@
         buf.append( failures );
         buf.append( ", Errors: " );
         buf.append( errors );
+        buf.append( ", Skipped: " );
+        buf.append( skipped );
         buf.append( ", Time elapsed: " );
         buf.append( elapsedTimeAsString( System.currentTimeMillis() - testSetStartTime )
);
         buf.append( " sec" );

Modified: maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/report/Reporter.java
URL: http://svn.apache.org/viewcvs/maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/report/Reporter.java?rev=383011&r1=383010&r2=383011&view=diff
==============================================================================
--- maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/report/Reporter.java
(original)
+++ maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/report/Reporter.java
Fri Mar  3 19:27:14 2006
@@ -46,6 +46,8 @@
 
     void testFailed( ReportEntry report, String stdOut, String stdErr );
 
+    void testSkipped( ReportEntry report );
+
     // Counters
     void reset();
 
@@ -54,4 +56,6 @@
     int getNumFailures();
 
     int getNumTests();
+
+    int getNumSkipped();
 }

Modified: maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/report/ReporterManager.java
URL: http://svn.apache.org/viewcvs/maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/report/ReporterManager.java?rev=383011&r1=383010&r2=383011&view=diff
==============================================================================
--- maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/report/ReporterManager.java
(original)
+++ maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/report/ReporterManager.java
Fri Mar  3 19:27:14 2006
@@ -41,6 +41,8 @@
 
     private PrintStream newOut;
 
+    private int skipped;
+
     public ReporterManager( List reports )
     {
         this.reports = reports;
@@ -144,7 +146,8 @@
 
         writeMessage( "" );
         writeMessage( "Results :" );
-        writeMessage( "Tests run: " + completedCount + ", Failures: " + failures + ", Errors:
" + errors );
+        writeMessage( "Tests run: " + completedCount + ", Failures: " + failures + ", Errors:
" + errors +
+            ", Skipped: " + skipped );
         writeMessage( "" );
     }
 
@@ -169,6 +172,8 @@
         {
             Reporter reporter = (Reporter) reports.get( 0 );
 
+            skipped += reporter.getNumSkipped();
+
             errors += reporter.getNumErrors();
 
             failures += reporter.getNumFailures();
@@ -317,4 +322,15 @@
         return completedCount;
     }
 
+    public void testSkipped( ReportEntry report )
+    {
+        resetStreams();
+
+        for ( Iterator it = reports.iterator(); it.hasNext(); )
+        {
+            Reporter reporter = (Reporter) it.next();
+
+            reporter.testSkipped( report );
+        }
+    }
 }

Modified: maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/report/XMLReporter.java
URL: http://svn.apache.org/viewcvs/maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/report/XMLReporter.java?rev=383011&r1=383010&r2=383011&view=diff
==============================================================================
--- maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/report/XMLReporter.java
(original)
+++ maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/report/XMLReporter.java
Fri Mar  3 19:27:14 2006
@@ -107,6 +107,8 @@
 
         testSuite.setAttribute( "errors", String.valueOf( this.getNumErrors() ) );
 
+        testSuite.setAttribute( "skipped", String.valueOf( this.getNumSkipped() ) );
+
         testSuite.setAttribute( "failures", String.valueOf( this.getNumFailures() ) );
 
         long runTime = System.currentTimeMillis() - testSetStartTime;

Modified: maven/surefire/branches/surefire-testng/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGReporter.java
URL: http://svn.apache.org/viewcvs/maven/surefire/branches/surefire-testng/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGReporter.java?rev=383011&r1=383010&r2=383011&view=diff
==============================================================================
--- maven/surefire/branches/surefire-testng/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGReporter.java
(original)
+++ maven/surefire/branches/surefire-testng/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGReporter.java
Fri Mar  3 19:27:14 2006
@@ -40,7 +40,6 @@
 public class TestNGReporter
     implements ITestListener, ISuiteListener
 {
-    // TODO: check the bundles
     private ResourceBundle bundle = ResourceBundle.getBundle( Surefire.SUREFIRE_BUNDLE_NAME
);
 
     /**
@@ -104,8 +103,7 @@
     {
         ReportEntry report = new ReportEntry( source, result.getName(), bundle.getString(
"testSkipped" ) );
 
-        // TODO: is this correct?
-        reportManager.testSucceeded( report );
+        reportManager.testSkipped( report );
     }
 
     public void onTestFailedButWithinSuccessPercentage( ITestResult result )



Mime
View raw message