@Test public void shouldIndicateWhenATestIsRunning() { StepEventBus.getEventBus().dropAllListeners(); StepEventBus.getEventBus().testStarted("a_test", SampleTestScenario.class); StepEventBus.getEventBus().stepStarted(ExecutedStepDescription.withTitle("a step")); assertThat(StepEventBus.getEventBus().areStepsRunning(), is(true)); }
@Test public void a_step_can_be_marked_pending() { StepEventBus.getEventBus().testStarted("a_test", SampleTestScenario.class); StepEventBus.getEventBus().stepStarted(ExecutedStepDescription.withTitle("a step")); StepEventBus.getEventBus().stepPending(); StepEventBus.getEventBus().testFinished(testOutcome); String expectedSteps = "TEST a_test\n" + "-a step\n" + "---> STEP PENDING\n" + "TEST DONE\n"; assertThat(consoleStepListener.toString(), is(expectedSteps)); }
@Test public void the_step_event_bus_can_be_used_to_sent_notification_events_about_steps() { SimpleTestScenarioSteps steps = factory.getStepLibraryFor(SimpleTestScenarioSteps.class); StepEventBus.getEventBus().testSuiteStarted(SampleTestScenario.class); StepEventBus.getEventBus().testStarted("some_test"); StepEventBus.getEventBus().stepStarted(ExecutedStepDescription.withTitle("a step")); verify(listener).stepStarted(any(ExecutedStepDescription.class)); }
@Test public void should_clear_all_listeners_when_requested() { StepEventBus.getEventBus().dropAllListeners(); StepEventBus.getEventBus().testStarted("a_test", SampleTestScenario.class); StepEventBus.getEventBus().stepStarted(ExecutedStepDescription.withTitle("a step")); StepEventBus.getEventBus().stepPending(); StepEventBus.getEventBus().testFinished(testOutcome); assertThat(consoleStepListener.toString(), is("")); }