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