Search in sources :

Example 1 with TestIgnoredEvent

use of com.intellij.execution.testframework.sm.runner.events.TestIgnoredEvent 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)));
}
Also used : TestStartedEvent(com.intellij.execution.testframework.sm.runner.events.TestStartedEvent) TestIgnoredEvent(com.intellij.execution.testframework.sm.runner.events.TestIgnoredEvent) TestOutputEvent(com.intellij.execution.testframework.sm.runner.events.TestOutputEvent) TestFinishedEvent(com.intellij.execution.testframework.sm.runner.events.TestFinishedEvent) ArrayList(java.util.ArrayList) ImmutableList(com.google.common.collect.ImmutableList) List(java.util.List) ErrorOrFailureOrSkipped(com.google.idea.blaze.base.run.smrunner.BlazeXmlSchema.ErrorOrFailureOrSkipped)

Aggregations

ImmutableList (com.google.common.collect.ImmutableList)1 ErrorOrFailureOrSkipped (com.google.idea.blaze.base.run.smrunner.BlazeXmlSchema.ErrorOrFailureOrSkipped)1 TestFinishedEvent (com.intellij.execution.testframework.sm.runner.events.TestFinishedEvent)1 TestIgnoredEvent (com.intellij.execution.testframework.sm.runner.events.TestIgnoredEvent)1 TestOutputEvent (com.intellij.execution.testframework.sm.runner.events.TestOutputEvent)1 TestStartedEvent (com.intellij.execution.testframework.sm.runner.events.TestStartedEvent)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1