Search in sources :

Example 16 with SMTestProxy

use of com.intellij.execution.testframework.sm.runner.SMTestProxy in project intellij-community by JetBrains.

the class SMTRunnerFiltersTest method testShowPassedHideIgnored.

public void testShowPassedHideIgnored() {
    TestConsoleProperties.HIDE_IGNORED_TEST.set(myProperties, true);
    final SMTRunnerTreeStructure treeStructure = myResultsForm.getTreeBuilder().getSMRunnerTreeStructure();
    final Object[] suites = treeStructure.getChildElements(mySuite);
    assertTrue(suites.length == 1);
    final Object[] tests = treeStructure.getChildElements(suites[0]);
    assertTrue(tests.length == 1);
    assertTrue(tests[0] instanceof SMTestProxy && "testPassed1".equals(((SMTestProxy) tests[0]).getName()));
}
Also used : SMTestProxy(com.intellij.execution.testframework.sm.runner.SMTestProxy) SMTRunnerTreeStructure(com.intellij.execution.testframework.sm.runner.SMTRunnerTreeStructure)

Example 17 with SMTestProxy

use of com.intellij.execution.testframework.sm.runner.SMTestProxy in project intellij-community by JetBrains.

the class AfterSuiteEvent method process.

@Override
public void process(@NotNull TestEventXmlView eventXml) throws TestEventXmlView.XmlParserException {
    final String testId = eventXml.getTestId();
    final TestEventResult result = TestEventResult.fromValue(eventXml.getTestEventResultType());
    addToInvokeLater(() -> {
        final SMTestProxy testProxy = findTestProxy(testId);
        if (testProxy == null)
            return;
        switch(result) {
            case SUCCESS:
                testProxy.setFinished();
                break;
            case FAILURE:
                testProxy.setTestFailed("", null, false);
                break;
            case SKIPPED:
                testProxy.setTestIgnored(null, null);
                break;
            case UNKNOWN_RESULT:
                break;
        }
        getResultsViewer().onSuiteFinished(testProxy);
    });
}
Also used : SMTestProxy(com.intellij.execution.testframework.sm.runner.SMTestProxy)

Example 18 with SMTestProxy

use of com.intellij.execution.testframework.sm.runner.SMTestProxy in project intellij-community by JetBrains.

the class BeforeTestEvent method process.

@Override
public void process(@NotNull final TestEventXmlView eventXml) throws TestEventXmlView.XmlParserException {
    final String testId = eventXml.getTestId();
    final String parentTestId = eventXml.getTestParentId();
    final String name = eventXml.getTestName();
    final String fqClassName = eventXml.getTestClassName();
    String locationUrl = findLocationUrl(name, fqClassName);
    final GradleSMTestProxy testProxy = new GradleSMTestProxy(name, false, locationUrl, fqClassName);
    testProxy.setStarted();
    testProxy.setLocator(getExecutionConsole().getUrlProvider());
    registerTestProxy(testId, testProxy);
    if (StringUtil.isEmpty(parentTestId)) {
        addToInvokeLater(() -> getResultsViewer().getTestsRootNode().addChild(testProxy));
    } else {
        final SMTestProxy parentTestProxy = findTestProxy(parentTestId);
        if (parentTestProxy != null) {
            addToInvokeLater(() -> {
                final List<GradleSMTestProxy> notYetAddedParents = ContainerUtil.newSmartList();
                SMTestProxy currentParentTestProxy = parentTestProxy;
                while (currentParentTestProxy != null && currentParentTestProxy instanceof GradleSMTestProxy) {
                    final String parentId = ((GradleSMTestProxy) currentParentTestProxy).getParentId();
                    if (currentParentTestProxy.getParent() == null && parentId != null) {
                        notYetAddedParents.add((GradleSMTestProxy) currentParentTestProxy);
                    }
                    currentParentTestProxy = findTestProxy(parentId);
                }
                for (GradleSMTestProxy gradleSMTestProxy : ContainerUtil.reverse(notYetAddedParents)) {
                    final SMTestProxy parentTestProxy1 = findTestProxy(gradleSMTestProxy.getParentId());
                    if (parentTestProxy1 != null) {
                        parentTestProxy1.addChild(gradleSMTestProxy);
                        getResultsViewer().onSuiteStarted(gradleSMTestProxy);
                    }
                }
                parentTestProxy.addChild(testProxy);
            });
        }
    }
    addToInvokeLater(() -> getResultsViewer().onTestStarted(testProxy));
}
Also used : SMTestProxy(com.intellij.execution.testframework.sm.runner.SMTestProxy) GradleSMTestProxy(org.jetbrains.plugins.gradle.execution.test.runner.GradleSMTestProxy) GradleSMTestProxy(org.jetbrains.plugins.gradle.execution.test.runner.GradleSMTestProxy)

Example 19 with SMTestProxy

use of com.intellij.execution.testframework.sm.runner.SMTestProxy in project intellij-community by JetBrains.

the class OnOutputEvent method process.

@Override
public void process(@NotNull final TestEventXmlView eventXml) throws TestEventXmlView.XmlParserException {
    final String testId = eventXml.getTestId();
    final String destination = eventXml.getTestEventTestDescription();
    final String output = decode(eventXml.getTestEventTest());
    SMTestProxy testProxy = findTestProxy(testId);
    if (testProxy == null)
        return;
    testProxy.addStdOutput(output, "StdOut".equals(destination) ? ProcessOutputTypes.STDOUT : ProcessOutputTypes.STDERR);
}
Also used : SMTestProxy(com.intellij.execution.testframework.sm.runner.SMTestProxy)

Example 20 with SMTestProxy

use of com.intellij.execution.testframework.sm.runner.SMTestProxy in project intellij-community by JetBrains.

the class SMTRunnerUIActionsHandler method onTestingFinished.

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);
        }
    }
}
Also used : SMTestProxy(com.intellij.execution.testframework.sm.runner.SMTestProxy) AbstractTestProxy(com.intellij.execution.testframework.AbstractTestProxy)

Aggregations

SMTestProxy (com.intellij.execution.testframework.sm.runner.SMTestProxy)42 GlobalSearchScope (com.intellij.psi.search.GlobalSearchScope)9 Project (com.intellij.openapi.project.Project)8 Location (com.intellij.execution.Location)6 PsiClass (com.intellij.psi.PsiClass)6 MethodLocation (com.intellij.execution.junit2.info.MethodLocation)5 PsiMemberParameterizedLocation (com.intellij.execution.junit2.PsiMemberParameterizedLocation)4 PsiElement (com.intellij.psi.PsiElement)4 PsiMethod (com.intellij.psi.PsiMethod)4 JavaTestLocator (com.intellij.execution.testframework.JavaTestLocator)3 List (java.util.List)3 AbstractTestProxy (com.intellij.execution.testframework.AbstractTestProxy)2 SMTRunnerTreeStructure (com.intellij.execution.testframework.sm.runner.SMTRunnerTreeStructure)2 Ref (com.intellij.openapi.util.Ref)2 HashMap (java.util.HashMap)2 LinkedHashMap (java.util.LinkedHashMap)2 Map (java.util.Map)2 NotNull (org.jetbrains.annotations.NotNull)2 ExecutionException (com.intellij.execution.ExecutionException)1 JavaTestConfigurationBase (com.intellij.execution.JavaTestConfigurationBase)1