use of io.cucumber.plugin.event.TestStepStarted in project cucumber-jvm by cucumber.
the class JUnitReporterWithStepNotificationsTest method test_step_undefined_fires_test_failure_and_test_finished_for_undefined_step.
@Test
void test_step_undefined_fires_test_failure_and_test_finished_for_undefined_step() {
jUnitReporter.startExecutionUnit(pickleRunner, runNotifier);
Suggestion suggestion = new Suggestion("step name", singletonList("some snippet"));
bus.send(new SnippetsSuggestedEvent(now(), featureUri, scenarioLine, scenarioLine, suggestion));
bus.send(new TestCaseStarted(now(), testCase));
bus.send(new TestStepStarted(now(), testCase, mockTestStep(step)));
Throwable exception = new CucumberException("No step definitions found");
Result result = new Result(Status.UNDEFINED, ZERO, exception);
bus.send(new TestStepFinished(now(), testCase, mockTestStep(step), result));
verify(runNotifier).fireTestFailure(failureArgumentCaptor.capture());
verify(runNotifier).fireTestFinished(pickleRunner.describeChild(step));
Failure stepFailure = failureArgumentCaptor.getValue();
assertThat(stepFailure.getDescription(), is(equalTo(pickleRunner.describeChild(step))));
assertThat(stepFailure.getException(), is(equalTo(exception)));
bus.send(new TestCaseFinished(now(), testCase, result));
verify(runNotifier, times(2)).fireTestFailure(failureArgumentCaptor.capture());
verify(runNotifier).fireTestFinished(pickleRunner.describeChild(step));
Failure pickleFailure = failureArgumentCaptor.getValue();
assertThat(pickleFailure.getDescription(), is(equalTo(pickleRunner.getDescription())));
assertThat(pickleFailure.getException().getMessage(), is("" + "The step 'step name' is undefined.\n" + "You can implement this step using the snippet(s) below:\n" + "\n" + "some snippet\n"));
}
use of io.cucumber.plugin.event.TestStepStarted in project cucumber-jvm by cucumber.
the class JUnitReporterWithStepNotificationsTest method test_step_finished_fires_test_failure_and_test_finished_for_skipped_step_with_pending_exception.
@Test
void test_step_finished_fires_test_failure_and_test_finished_for_skipped_step_with_pending_exception() {
jUnitReporter.startExecutionUnit(pickleRunner, runNotifier);
bus.send(new TestCaseStarted(now(), testCase));
bus.send(new TestStepStarted(now(), testCase, mockTestStep(step)));
Throwable exception = new TestPendingException("Oops");
Result result = new Result(Status.PENDING, ZERO, exception);
bus.send(new TestStepFinished(now(), testCase, mockTestStep(step), result));
verify(runNotifier).fireTestFailure(failureArgumentCaptor.capture());
verify(runNotifier).fireTestFinished(pickleRunner.describeChild(step));
Failure stepFailure = failureArgumentCaptor.getValue();
assertThat(stepFailure.getDescription(), is(equalTo(pickleRunner.describeChild(step))));
assertThat(stepFailure.getException(), is(equalTo(exception)));
bus.send(new TestCaseFinished(now(), testCase, result));
verify(runNotifier, times(2)).fireTestFailure(failureArgumentCaptor.capture());
verify(runNotifier).fireTestFinished(pickleRunner.describeChild(step));
Failure pickleFailure = failureArgumentCaptor.getValue();
assertThat(pickleFailure.getDescription(), is(equalTo(pickleRunner.getDescription())));
assertThat(pickleFailure.getException(), is(equalTo(exception)));
}
use of io.cucumber.plugin.event.TestStepStarted in project cucumber-jvm by cucumber.
the class JUnitReporterWithStepNotificationsTest method test_step_finished_fires_test_failure_and_test_finished_for_failed_step.
@Test
void test_step_finished_fires_test_failure_and_test_finished_for_failed_step() {
jUnitReporter.startExecutionUnit(pickleRunner, runNotifier);
bus.send(new TestCaseStarted(now(), testCase));
bus.send(new TestStepStarted(now(), testCase, mockTestStep(step)));
Throwable exception = new Exception("Oops");
Result result = new Result(Status.FAILED, ZERO, exception);
bus.send(new TestStepFinished(now(), testCase, mockTestStep(step), result));
verify(runNotifier).fireTestFailure(failureArgumentCaptor.capture());
verify(runNotifier).fireTestFinished(pickleRunner.describeChild(step));
Failure stepFailure = failureArgumentCaptor.getValue();
assertThat(stepFailure.getDescription(), is(equalTo(pickleRunner.describeChild(step))));
assertThat(stepFailure.getException(), is(equalTo(exception)));
bus.send(new TestCaseFinished(now(), testCase, result));
verify(runNotifier, times(2)).fireTestFailure(failureArgumentCaptor.capture());
verify(runNotifier).fireTestFinished(pickleRunner.describeChild(step));
Failure pickleFailure = failureArgumentCaptor.getValue();
assertThat(pickleFailure.getDescription(), is(equalTo(pickleRunner.getDescription())));
assertThat(pickleFailure.getException(), is(equalTo(exception)));
}
use of io.cucumber.plugin.event.TestStepStarted in project cucumber-jvm by cucumber.
the class JUnitReporterWithStepNotificationsTest method test_step_started_fires_test_started_for_step.
@Test
void test_step_started_fires_test_started_for_step() {
jUnitReporter.startExecutionUnit(pickleRunner, runNotifier);
bus.send(new TestCaseStarted(now(), testCase));
bus.send(new TestStepStarted(now(), testCase, mockTestStep(step)));
jUnitReporter.finishExecutionUnit();
}
use of io.cucumber.plugin.event.TestStepStarted in project cucumber-jvm by cucumber.
the class JUnitReporterWithStepNotificationsTest method test_case_finished_fires_test_finished_for_pickle.
@Test
void test_case_finished_fires_test_finished_for_pickle() {
jUnitReporter.startExecutionUnit(pickleRunner, runNotifier);
bus.send(new TestCaseStarted(now(), testCase));
bus.send(new TestStepStarted(now(), testCase, mockTestStep(step)));
Result result = new Result(Status.PASSED, ZERO, null);
bus.send(new TestStepFinished(now(), testCase, mockTestStep(step), result));
bus.send(new TestCaseFinished(now(), testCase, result));
verify(runNotifier).fireTestStarted(pickleRunner.describeChild(step));
verify(runNotifier).fireTestFinished(pickleRunner.describeChild(step));
}
Aggregations