use of io.cucumber.plugin.event.Result in project cucumber-jvm by cucumber.
the class TestCaseResultObserverTest method passed.
@Test
void passed() {
bus.send(new TestCaseStarted(Instant.now(), testCase));
bus.send(new TestStepStarted(Instant.now(), testCase, testStep));
Result result = new Result(Status.PASSED, Duration.ZERO, null);
bus.send(new TestStepFinished(Instant.now(), testCase, testStep, result));
bus.send(new TestCaseFinished(Instant.now(), testCase, result));
observer.assertTestCasePassed();
}
use of io.cucumber.plugin.event.Result in project cucumber-jvm by cucumber.
the class TestCaseResultObserverTest method failed.
@Test
void failed() {
bus.send(new TestCaseStarted(Instant.now(), testCase));
bus.send(new TestStepStarted(Instant.now(), testCase, testStep));
Throwable error = new AssertionFailedError("Mocked");
Result result = new Result(Status.FAILED, Duration.ZERO, error);
bus.send(new TestStepFinished(Instant.now(), testCase, testStep, result));
bus.send(new TestCaseFinished(Instant.now(), testCase, result));
Exception exception = assertThrows(Exception.class, observer::assertTestCasePassed);
assertThat(exception.getCause(), is(error));
}
use of io.cucumber.plugin.event.Result in project cucumber-jvm by cucumber.
the class CucumberExecutionContext method emitTestRunFinished.
private void emitTestRunFinished(Throwable exception) {
Instant instant = bus.getInstant();
Result result = new Result(exception != null ? Status.FAILED : exitStatus.getStatus(), Duration.between(start, instant), exception);
bus.send(new TestRunFinished(instant, result));
io.cucumber.messages.types.TestRunFinished testRunFinished = new io.cucumber.messages.types.TestRunFinished(exception != null ? printStackTrace(exception) : null, exception == null && exitStatus.isSuccess(), javaInstantToTimestamp(instant));
Envelope envelope = new Envelope();
envelope.setTestRunFinished(testRunFinished);
bus.send(envelope);
}
use of io.cucumber.plugin.event.Result in project cucumber-jvm by cucumber.
the class PrettyFormatter method printError.
private void printError(TestRunFinished event) {
Result result = event.getResult();
printError(result);
}
use of io.cucumber.plugin.event.Result in project cucumber-jvm by cucumber.
the class PrettyFormatter method printError.
private void printError(TestStepFinished event) {
Result result = event.getResult();
printError(result);
}
Aggregations