use of com.intellij.execution.testframework.sm.runner.events.TestStartedEvent in project buck by facebook.
the class BuckToGeneralTestEventsConverter method consumeTestResultsAvailable.
@Override
public void consumeTestResultsAvailable(long timestamp, TestResults testResults) {
final GeneralTestEventsProcessor processor = getProcessor();
if (processor == null) {
return;
}
for (TestCaseSummary suite : testResults.getTestCases()) {
if (suite.getTestResults().isEmpty()) {
continue;
}
final String locationUrl = null;
processor.onSuiteStarted(new TestSuiteStartedEvent(suite.getTestCaseName(), locationUrl));
for (TestResultsSummary test : suite.getTestResults()) {
final String testName = test.getTestName();
processor.onTestStarted(new TestStartedEvent(testName, null));
final String stdOut = test.getStdOut();
if (stdOut != null) {
processor.onTestOutput(new TestOutputEvent(testName, stdOut, true));
}
final String stdErr = test.getStdErr();
if (stdErr != null) {
processor.onTestOutput(new TestOutputEvent(testName, stdErr, false));
}
if (test.getType() == ResultType.FAILURE) {
processor.onTestFailure(new TestFailedEvent(testName, "", test.getStacktrace(), true, null, null));
} else {
processor.onTestFinished(new TestFinishedEvent(testName, test.getTime()));
}
}
processor.onSuiteFinished(new TestSuiteFinishedEvent(suite.getTestCaseName()));
}
}
use of com.intellij.execution.testframework.sm.runner.events.TestStartedEvent in project intellij by bazelbuild.
the class BlazeXmlToTestEventsConverter method processTestCase.
private static void processTestCase(GeneralTestEventsProcessor processor, BlazeTestEventsHandler eventsHandler, @Nullable Kind kind, TestSuite parent, TestCase test) {
if (test.name == null || !wasRun(test) || isCancelled(test)) {
return;
}
String displayName = eventsHandler.testDisplayName(kind, test.name);
String locationUrl = eventsHandler.testLocationUrl(kind, parent.name, test.name, test.classname);
processor.onTestStarted(new TestStartedEvent(displayName, locationUrl));
if (test.sysOut != null) {
processor.onTestOutput(new TestOutputEvent(displayName, test.sysOut, true));
}
if (test.sysErr != null) {
processor.onTestOutput(new TestOutputEvent(displayName, test.sysErr, true));
}
if (isIgnored(test)) {
ErrorOrFailureOrSkipped err = test.skipped != null ? test.skipped : NO_ERROR;
processor.onTestIgnored(new TestIgnoredEvent(displayName, err.message, err.content));
} else if (isFailed(test)) {
List<ErrorOrFailureOrSkipped> errors = !test.failures.isEmpty() ? test.failures : !test.errors.isEmpty() ? test.errors : ImmutableList.of(NO_ERROR);
for (ErrorOrFailureOrSkipped err : errors) {
processor.onTestFailure(getTestFailedEvent(displayName, err.message, err.content, parseTimeMillis(test.time)));
}
}
processor.onTestFinished(new TestFinishedEvent(displayName, parseTimeMillis(test.time)));
}
use of com.intellij.execution.testframework.sm.runner.events.TestStartedEvent in project intellij by bazelbuild.
the class BlazeXmlToTestEventsConverter method reportTargetWithoutOutputFiles.
/**
* If there are no output files, the test may have failed to build, or timed out. Provide a
* suitable message in the test UI.
*/
private void reportTargetWithoutOutputFiles(Label label, TestStatus status) {
if (status == TestStatus.PASSED) {
// Empty test targets do not produce output XML, yet technically pass. Ignore them.
return;
}
GeneralTestEventsProcessor processor = getProcessor();
TestSuiteStarted suiteStarted = new TestSuiteStarted(label.toString());
processor.onSuiteStarted(new TestSuiteStartedEvent(suiteStarted, /*locationUrl=*/
null));
String targetName = label.targetName().toString();
processor.onTestStarted(new TestStartedEvent(targetName, /*locationUrl=*/
null));
processor.onTestFailure(getTestFailedEvent(targetName, STATUS_EXPLANATIONS.get(status) + " See console output for details", /*content=*/
null, /*duration=*/
0));
processor.onTestFinished(new TestFinishedEvent(targetName, /*duration=*/
0L));
processor.onSuiteFinished(new TestSuiteFinishedEvent(label.toString()));
}
Aggregations