use of io.cucumber.plugin.event.Result in project syndesis-qe by syndesisio.
the class PrettyFormatter method printError.
private void printError(TestStepFinished event) {
Result result = event.getResult();
Throwable error = result.getError();
if (error != null) {
String name = result.getStatus().name().toLowerCase(ROOT);
String text = printStackTrace(error);
out.println(" " + formats.get(name).text(text));
}
}
use of io.cucumber.plugin.event.Result in project cucumber-jvm by cucumber.
the class EventBusTest method handlers_receive_the_events_they_registered_for.
@Test
void handlers_receive_the_events_they_registered_for() {
EventHandler<TestStepFinished> handler = mock(EventHandler.class);
PickleStepTestStep testStep = mock(PickleStepTestStep.class);
Result result = new Result(Status.PASSED, ZERO, null);
TestCase testCase = mock(TestCase.class);
TestStepFinished event = new TestStepFinished(EPOCH, testCase, testStep, result);
EventBus bus = new TimeServiceEventBus(Clock.fixed(Instant.EPOCH, ZoneId.of("UTC")), UUID::randomUUID);
bus.registerHandlerFor(TestStepFinished.class, handler);
bus.send(event);
verify(handler).receive(event);
}
use of io.cucumber.plugin.event.Result in project cucumber-jvm by cucumber.
the class PickleStepTestStepTest method result_is_result_from_hook_when_before_step_hook_does_not_pass.
@Test
void result_is_result_from_hook_when_before_step_hook_does_not_pass() {
Exception exception = new RuntimeException();
doThrow(exception).when(beforeHookDefinition).execute(any(TestCaseState.class));
Result failure = new Result(Status.FAILED, ZERO, exception);
ExecutionMode nextExecutionMode = step.run(testCase, bus, state, ExecutionMode.RUN);
assertThat(nextExecutionMode, is(ExecutionMode.SKIP));
assertThat(state.getStatus(), is(equalTo(FAILED)));
ArgumentCaptor<TestCaseEvent> captor = forClass(TestCaseEvent.class);
verify(bus, times(12)).send(captor.capture());
List<TestCaseEvent> allValues = captor.getAllValues();
assertThat(((TestStepFinished) allValues.get(2)).getResult(), is(equalTo(failure)));
}
use of io.cucumber.plugin.event.Result in project cucumber-jvm by cucumber.
the class ResultTest method is_query_returns_false_for_statuses_different_from_the_status_of_the_result_object.
@Test
void is_query_returns_false_for_statuses_different_from_the_status_of_the_result_object() {
int checkCount = 0;
for (Status resultStatus : Status.values()) {
Result result = new Result(resultStatus, ZERO, null);
for (Status status : Status.values()) {
if (status != resultStatus) {
assertFalse(result.getStatus().is(status));
checkCount += 1;
}
}
}
assertThat("No checks performed", checkCount > 0, is(equalTo(true)));
}
use of io.cucumber.plugin.event.Result in project cucumber-jvm by cucumber.
the class ResultTest method skipped_result_is_ok.
@Test
void skipped_result_is_ok() {
Result skippedResult = new Result(SKIPPED, ZERO, null);
assertTrue(skippedResult.getStatus().isOk());
}
Aggregations