public void onTestingFinished(final TestResultsViewer sender) {
    // select first defect at the end (my be TRACK_RUNNING_TEST was enabled and affects on the fly
    // selection)
    final SMTestProxy testsRootNode = sender.getTestsRootNode();
    if (TestConsoleProperties.SELECT_FIRST_DEFECT.value(myConsoleProperties)) {
      final AbstractTestProxy firstDefect;

      // defects priority:
      // ERROR -> FAILURE -> GENERAL DEFECTIVE NODE
      final List<SMTestProxy> allTests = testsRootNode.getAllTests();
      final AbstractTestProxy firstError = ProxyFilters.ERROR_LEAF.detectIn(allTests);
      if (firstError != null) {
        firstDefect = firstError;
      } else {
        final AbstractTestProxy firstFailure = ProxyFilters.FAILURE_LEAF.detectIn(allTests);
        if (firstFailure != null) {
          firstDefect = firstFailure;
        } else {
          firstDefect = null;
        }
      }

      // select if detected
      if (firstDefect != null) {
        sender.selectAndNotify(firstDefect);
      }
    }
  }
  public static SMTestProxy.SMRootTestProxy createFromClassResult(ClassResult classResult) {
    SMTestProxy.SMRootTestProxy classNode = new SMTestProxy.SMRootTestProxy();
    classNode.setPresentation(classResult.getName());
    classNode.setFinished();

    if (classResult.getState().equals(ClassResult.STATE_FAILED)) {
      classNode.setTestFailed("", "", true);
    }

    for (MethodResult methodsResult : classResult.getMethods()) {
      SMTestProxy methodNode = new SMTestProxy(methodsResult.getName(), false, "");

      if (methodsResult.getState().equals(MethodResult.STATE_FAILED)) {
        methodNode.setTestFailed(
            methodsResult.getName() + " Failed", methodsResult.getContent(), true);
      } else if (methodsResult.getState().equals(MethodResult.STATE_PASSED)) {
        methodNode.addSystemOutput(methodsResult.getContent());
      }

      methodNode.setFinished();
      classNode.addChild(methodNode);
    }

    return classNode;
  }
  public static void updateFromTestResult(TestsResult testsResult, SMTestProxy testsRootNode) {
    for (ClassResult classResult : testsResult.getClassResults()) {
      testsRootNode.addChild(SMTRootTestProxyFactory.createFromClassResult(classResult));
    }

    if (testsResult.getState().equals(TestsResult.STATE_FAILED)) {
      testsRootNode.setTestFailed("", "", true);
    }
  }
Beispiel #4
0
  private void _addTestOrSuite(@NotNull final SMTestProxy newTestOrSuite) {

    final SMTestProxy parentSuite = newTestOrSuite.getParent();
    assert parentSuite != null;

    // Tree
    final Update update =
        new Update(parentSuite) {
          @Override
          public void run() {
            myRequests.remove(this);
            myTreeBuilder.updateTestsSubtree(parentSuite);
          }
        };
    if (ApplicationManager.getApplication().isUnitTestMode()) {
      update.run();
    } else if (myRequests.add(update) && !myUpdateQueue.isDisposed()) {
      myUpdateQueue.addRequest(update, 100);
    }
    myTreeBuilder.repaintWithParents(newTestOrSuite);

    myAnimator.setCurrentTestCase(newTestOrSuite);

    if (TestConsoleProperties.TRACK_RUNNING_TEST.value(myProperties)) {
      if (myLastSelected == null || myLastSelected == newTestOrSuite) {
        myLastSelected = null;
        selectAndNotify(newTestOrSuite);
      }
    }
  }
Beispiel #5
0
 /**
  * Adds test to tree and updates status line. Test proxy should be initialized, proxy parent must
  * be some suite (already added to tree)
  *
  * @param testProxy Proxy
  */
 public void onTestStarted(@NotNull final SMTestProxy testProxy) {
   if (!testProxy.isConfig()) {
     updateOnTestStarted(false);
   }
   _addTestOrSuite(testProxy);
   fireOnTestNodeAdded(testProxy);
 }
 @Override
 public void setTestComparisonFailed(
     @NotNull String localizedMessage,
     @Nullable String stackTrace,
     @NotNull String actualText,
     @NotNull String expectedText) {
   setStacktraceIfNotSet(stackTrace);
   super.setTestComparisonFailed(localizedMessage, stackTrace, actualText, expectedText);
 }
Beispiel #7
0
  public void onTestFailed(@NotNull final SMTestProxy test) {
    updateOnTestFailed(false);
    if (test.isConfig()) {
      myStartedTestCount++;
      myFinishedTestCount++;
    }
    updateIconProgress(false);

    // still expand failure when user selected another test
    if (myLastSelected != null
        && TestConsoleProperties.TRACK_RUNNING_TEST.value(myProperties)
        && TestConsoleProperties.HIDE_PASSED_TESTS.value(myProperties)) {
      myTreeBuilder.expand(test, null);
    }
  }
Beispiel #8
0
 public void onTestFinished(@NotNull final SMTestProxy test) {
   if (!test.isConfig()) {
     updateOnTestFinished(false);
   }
   updateIconProgress(false);
 }
 @Override
 public void setTestIgnored(@Nullable String ignoreComment, @Nullable String stackTrace) {
   setStacktraceIfNotSet(stackTrace);
   super.setTestIgnored(ignoreComment, stackTrace);
 }
 @Override
 public void setTestFailed(
     @NotNull String localizedMessage, @Nullable String stackTrace, boolean testError) {
   setStacktraceIfNotSet(stackTrace);
   super.setTestFailed(localizedMessage, stackTrace, testError);
 }