Example #1
0
  public void onTestingFinished(@NotNull SMTestProxy.SMRootTestProxy testsRoot) {
    myEndTime = System.currentTimeMillis();

    if (myTotalTestCount == 0) {
      myTotalTestCount = myStartedTestCount;
      myStatusLine.setFraction(1);
    }

    updateStatusLabel(true);
    updateIconProgress(true);

    myAnimator.stopMovie();
    myTreeBuilder.updateFromRoot();

    LvcsHelper.addLabel(this);

    final Runnable onDone =
        new Runnable() {
          @Override
          public void run() {
            myTestsRunning = false;
            final boolean sortByDuration =
                TestConsoleProperties.SORT_BY_DURATION.value(myProperties);
            if (sortByDuration) {
              myTreeBuilder.setStatisticsComparator(myProperties, sortByDuration);
            }
          }
        };
    if (myLastSelected == null) {
      selectAndNotify(myTestsRootNode, onDone);
    } else {
      onDone.run();
    }

    fireOnTestingFinished();

    if (testsRoot.wasTerminated() && myStatusLine.getStatusColor() == ColorProgressBar.GREEN) {
      myStatusLine.setStatusColor(JBColor.LIGHT_GRAY);
    }

    if (testsRoot.isEmptySuite()
        && testsRoot.isTestsReporterAttached()
        && myProperties instanceof SMTRunnerConsoleProperties
        && ((SMTRunnerConsoleProperties) myProperties).fixEmptySuite()) {
      return;
    }
    final TestsUIUtil.TestResultPresentation presentation =
        new TestsUIUtil.TestResultPresentation(testsRoot, myStartTime > 0, null)
            .getPresentation(
                myFailedTestCount,
                myFinishedTestCount - myFailedTestCount - myIgnoredTestCount,
                myTotalTestCount - myFinishedTestCount,
                myIgnoredTestCount);
    TestsUIUtil.notifyByBalloon(myProperties.getProject(), testsRoot, myProperties, presentation);
    addToHistory(testsRoot, myProperties, this);
  }
Example #2
0
  /**
   * Returns root node, fake parent suite for all tests and suites
   *
   * @param testsRoot
   * @return
   */
  public void onTestingStarted(@NotNull SMTestProxy.SMRootTestProxy testsRoot) {
    myAnimator.setCurrentTestCase(myTestsRootNode);
    myTreeBuilder.updateFromRoot();

    // Status line
    myStatusLine.setStatusColor(ColorProgressBar.GREEN);

    // Tests tree
    selectAndNotify(myTestsRootNode);

    myStartTime = System.currentTimeMillis();
    boolean printTestingStartedTime = true;
    if (myProperties instanceof SMTRunnerConsoleProperties) {
      printTestingStartedTime =
          ((SMTRunnerConsoleProperties) myProperties).isPrintTestingStartedTime();
    }
    if (printTestingStartedTime) {
      myTestsRootNode.addSystemOutput(
          "Testing started at " + DateFormatUtil.formatTime(myStartTime) + " ...\n");
    }

    updateStatusLabel(false);

    // TODO : show info - "Loading..." msg

    fireOnTestingStarted();
  }
Example #3
0
  private void updateStatusLabel(final boolean testingFinished) {
    if (myFailedTestCount > 0) {
      myStatusLine.setStatusColor(ColorProgressBar.RED);
    }

    if (testingFinished) {
      if (myTotalTestCount == 0) {
        myStatusLine.setStatusColor(
            myTestsRootNode.wasLaunched() || !myTestsRootNode.isTestsReporterAttached()
                ? JBColor.LIGHT_GRAY
                : ColorProgressBar.RED);
      }
      // else color will be according failed/passed tests
    }

    // launchedAndFinished - is launched and not in progress. If we remove "launched' that
    // onTestingStarted() before
    // initializing will be "launchedAndFinished"
    final boolean launchedAndFinished =
        myTestsRootNode.wasLaunched() && !myTestsRootNode.isInProgress();
    if (!TestsPresentationUtil.hasNonDefaultCategories(myMentionedCategories)) {
      myStatusLine.formatTestMessage(
          myTotalTestCount,
          myFinishedTestCount,
          myFailedTestCount,
          myIgnoredTestCount,
          myTestsRootNode.getDuration(),
          myEndTime);
    } else {
      myStatusLine.setText(
          TestsPresentationUtil.getProgressStatus_Text(
              myStartTime,
              myEndTime,
              myTotalTestCount,
              myFinishedTestCount,
              myFailedTestCount,
              myMentionedCategories,
              launchedAndFinished));
    }
  }