use of io.cucumber.plugin.event.TestRunStarted in project cucumber-jvm by cucumber.
the class CucumberExecutionContextTest method emits_failures_in_events.
@Test
public void emits_failures_in_events() {
List<TestRunStarted> testRunStarted = new ArrayList<>();
List<TestRunFinished> testRunFinished = new ArrayList<>();
bus.registerHandlerFor(TestRunStarted.class, testRunStarted::add);
bus.registerHandlerFor(TestRunFinished.class, testRunFinished::add);
context.startTestRun();
assertThrows(IllegalStateException.class, () -> context.runTestCase(runner -> {
throw failure;
}));
context.finishTestRun();
assertThat(testRunStarted.get(0), notNullValue());
Result result = testRunFinished.get(0).getResult();
assertThat(result.getStatus(), is(Status.FAILED));
assertThat(result.getError(), is(failure));
}
use of io.cucumber.plugin.event.TestRunStarted in project cucumber-jvm by cucumber.
the class CucumberExecutionContext method emitTestRunStarted.
private void emitTestRunStarted() {
log.debug(() -> "Sending run test started event");
start = bus.getInstant();
bus.send(new TestRunStarted(start));
Envelope envelope = new Envelope();
envelope.setTestRunStarted(new io.cucumber.messages.types.TestRunStarted(javaInstantToTimestamp(start)));
bus.send(envelope);
}
Aggregations