use of io.cucumber.plugin.event.TestStepFinished in project cucumber-jvm by cucumber.
the class TestCaseResultObserverTest method should_be_passed_for_passed_result.
@Test
public void should_be_passed_for_passed_result() {
TestCaseResultObserver resultListener = TestCaseResultObserver.observe(bus);
Result stepResult = new Result(Status.PASSED, ZERO, null);
bus.send(new TestStepFinished(now(), testCase, step, stepResult));
Result testCaseResult = new Result(Status.PASSED, ZERO, null);
bus.send(new TestCaseFinished(now(), testCase, testCaseResult));
resultListener.assertTestCasePassed();
}
use of io.cucumber.plugin.event.TestStepFinished in project cucumber-jvm by cucumber.
the class TestCaseResultObserverTest method should_not_be_skipped_for_pending_result.
@Test
public void should_not_be_skipped_for_pending_result() {
TestCaseResultObserver resultListener = TestCaseResultObserver.observe(bus);
TestPendingException error = new TestPendingException();
Result stepResult = new Result(PENDING, ZERO, error);
bus.send(new TestStepFinished(now(), testCase, step, stepResult));
Result testCaseResult = new Result(PENDING, ZERO, error);
bus.send(new TestCaseFinished(now(), testCase, testCaseResult));
Exception exception = expectThrows(Exception.class, resultListener::assertTestCasePassed);
assertEquals(exception.getCause(), error);
}
use of io.cucumber.plugin.event.TestStepFinished in project cucumber-jvm by cucumber.
the class UsageFormatterTest method resultWithZeroDuration.
@Test
void resultWithZeroDuration() {
OutputStream out = new ByteArrayOutputStream();
UsageFormatter usageFormatter = new UsageFormatter(out);
TestStep testStep = mockTestStep();
Result result = new Result(Status.PASSED, Duration.ZERO, null);
usageFormatter.handleTestStepFinished(new TestStepFinished(Instant.EPOCH, mock(TestCase.class), testStep, result));
Map<String, List<UsageFormatter.StepContainer>> usageMap = usageFormatter.usageMap;
assertThat(usageMap.size(), is(equalTo(1)));
List<UsageFormatter.StepContainer> durationEntries = usageMap.get("stepDef");
assertThat(durationEntries.size(), is(equalTo(1)));
assertThat(durationEntries.get(0).getName(), is(equalTo("step")));
assertThat(durationEntries.get(0).getDurations().size(), is(equalTo(1)));
assertThat(durationEntries.get(0).getDurations().get(0).getDuration(), is(equalTo(0.0)));
}
Aggregations