don't count the same test twice in statistics if testFailed is followed by testFinished
authorSergey Simonchik <sergey.simonchik@jetbrains.com>
Wed, 19 Oct 2016 15:05:34 +0000 (18:05 +0300)
committerSergey Simonchik <sergey.simonchik@jetbrains.com>
Wed, 19 Oct 2016 15:05:34 +0000 (18:05 +0300)
platform/smRunner/src/com/intellij/execution/testframework/sm/runner/GeneralIdBasedToSMTRunnerEventsConvertor.java

index d7f3fd00cccbede118df4f67a82be11ef8c6d36c..231808d6bf7d10519ce70d93fbe0917861106f03 100644 (file)
@@ -178,7 +178,14 @@ public class GeneralIdBasedToSMTRunnerEventsConvertor extends GeneralTestEventsP
         testProxy.setDuration(testFinishedEvent.getDuration());
         testProxy.setFrameworkOutputFile(testFinishedEvent.getOutputFile());
         testProxy.setFinished();
-        fireOnTestFinished(testProxy);
+        if (node.getState() != State.FAILED) {
+          // Don't count the same test twice if 'testFailed' message is followed by 'testFinished' message
+          // which may happen if generated TeamCity messages adhere rules from
+          //   https://confluence.jetbrains.com/display/TCD10/Build+Script+Interaction+with+TeamCity
+          // Anyway, this id-based converter already breaks TeamCity protocol by expecting messages with
+          // non-standard TeamCity attributes: 'nodeId'/'parentNodeId' instead of 'name'.
+          fireOnTestFinished(testProxy);
+        }
         terminateNode(node, State.FINISHED);
       }
     });