You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ag...@apache.org on 2014/10/19 22:06:04 UTC

git commit: [SUREFIRE-1088] another alternative fix for handling of @Ignored test cases: seems like the problem was in the NonConcurrentRunListener that did not finish previous test sets in case of test errors.

Repository: maven-surefire
Updated Branches:
  refs/heads/master 5291f3ae6 -> 898475f88


[SUREFIRE-1088] another alternative fix for handling of @Ignored test cases: seems like the problem was in the NonConcurrentRunListener that did not finish previous test sets in case of test errors.


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

Branch: refs/heads/master
Commit: 898475f88253dcf751651c2d76d3f693ccc093a1
Parents: 5291f3a
Author: Andreas Gudian <ag...@apache.org>
Authored: Sun Oct 19 22:00:41 2014 +0200
Committer: Andreas Gudian <ag...@apache.org>
Committed: Sun Oct 19 22:00:41 2014 +0200

----------------------------------------------------------------------
 .../surefire/report/TestSetRunListener.java     | 33 --------------------
 .../junitcore/NonConcurrentRunListener.java     |  4 ++-
 2 files changed, 3 insertions(+), 34 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/898475f8/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetRunListener.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetRunListener.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetRunListener.java
index 701069f..7ec390e 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetRunListener.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetRunListener.java
@@ -24,7 +24,6 @@ import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.maven.plugin.surefire.runorder.StatisticsReporter;
-import org.apache.maven.shared.utils.StringUtils;
 import org.apache.maven.surefire.report.ConsoleLogger;
 import org.apache.maven.surefire.report.ConsoleOutputReceiver;
 import org.apache.maven.surefire.report.ReportEntry;
@@ -41,8 +40,6 @@ public class TestSetRunListener
 {
     private final TestSetStats detailsForThis;
 
-    private ReportEntry lastMarkedAsCompleteAfterSkipped;
-
     private List<TestMethodStats> testMethodStats;
 
     private Utf8RecodingDeferredFileOutputStream testStdOut = initDeferred( "stdout" );
@@ -128,12 +125,6 @@ public class TestSetRunListener
 
     public void testSetCompleted( ReportEntry report )
     {
-        if ( wasMarkedAsCompleteAfterSkipped( report ) )
-        {
-            lastMarkedAsCompleteAfterSkipped = null;
-            return;
-        }
-
         WrappedReportEntry wrap = wrapTestSet( report );
         List<String> testResults = briefOrPlainFormat ? detailsForThis.getTestResults() : null;
         if ( fileReporter != null )
@@ -166,13 +157,6 @@ public class TestSetRunListener
 
     }
 
-    private boolean wasMarkedAsCompleteAfterSkipped( ReportEntry report )
-    {
-        return null != lastMarkedAsCompleteAfterSkipped
-            && StringUtils.equals( lastMarkedAsCompleteAfterSkipped.getName(), report.getName() )
-            && StringUtils.equals( lastMarkedAsCompleteAfterSkipped.getSourceName(), report.getSourceName() );
-    }
-
     // ----------------------------------------------------------------------
     // Test
     // ----------------------------------------------------------------------
@@ -230,23 +214,6 @@ public class TestSetRunListener
             statisticsReporter.testSkipped( reportEntry );
         }
         clearCapture();
-
-        if ( looksLikeIgnoredTestSet( reportEntry ) )
-        {
-            // if a class is marked as @Ignored, the testSetCompleted method is not always called by the test provider,
-            // so we do that here.
-            testSetCompleted( reportEntry );
-            lastMarkedAsCompleteAfterSkipped = reportEntry;
-        }
-    }
-
-    /**
-     * @param reportEntry the report entry to check
-     * @return {@code true}, if the report entry looks like it belongs to an ignored test class
-     */
-    private boolean looksLikeIgnoredTestSet( ReportEntry reportEntry )
-    {
-        return StringUtils.equals( reportEntry.getName(), reportEntry.getSourceName() );
     }
 
     public void testAssumptionFailure( ReportEntry report )

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/898475f8/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/NonConcurrentRunListener.java
----------------------------------------------------------------------
diff --git a/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/NonConcurrentRunListener.java b/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/NonConcurrentRunListener.java
index 458b484..9d4e9c1 100644
--- a/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/NonConcurrentRunListener.java
+++ b/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/NonConcurrentRunListener.java
@@ -98,7 +98,7 @@ public class NonConcurrentRunListener
             {
                 return description.getChildren().equals( currentTestSetDescription.getChildren() );
             }
-            
+
             return false;
         }
 
@@ -127,6 +127,8 @@ public class NonConcurrentRunListener
     public void testFailure( Failure failure )
         throws Exception
     {
+        finishLastTestSetIfNecessary( failure.getDescription() );
+
         super.testFailure( failure );
         this.lastFinishedDescription = failure.getDescription();
     }