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 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); }
/** * 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(); }
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)); } }