Package org.moresbycoffee.mbyhave8.hooks

Examples of org.moresbycoffee.mbyhave8.hooks.StepHooks


    }

    @Test
    public void scenario_callbacks_should_be_invoked_when_scenarios_are_executed() {
        final MByHave8Hooks hooks = Mockito.mock(MByHave8Hooks.class);
        final InOrder inOrder = Mockito.inOrder(hooks);

        final MByHaveSpec spec = new MByHaveSpec() {{
            Feature("Test Feature1",
                    Scenario("Scenario1"),
View Full Code Here


*/
public class ScenarioCallbackInvocationTest {

    @Test
    public void the_secenario_callbacks_should_be_called_before_and_after_the_scenario() {
        final ScenarioHooks hooks = Mockito.mock(ScenarioHooks.class);
        final InOrder inOrder = Mockito.inOrder(hooks);

        final Scenario scenario = TestUtils.successScenario();

        scenario.execute(hooks);
View Full Code Here

    }

    private ScenarioOutput executeHelper(final BiFunction<Step, StepHooks, StepOutput> stepExecutor, final BiFunction<Step, StepHooks, StepOutput> skipStep, final ScenarioHooks hooks) {
        hooks.startScenario(this);

        final StepHooks stepHooks = new ScenarioAwareStepHook(id, hooks);

        ScenarioResult result = ScenarioResult.Success;
        final List<StepOutput> stepOutputs;
        if (steps.isEmpty()) {
            result = ScenarioResult.Pending;
View Full Code Here

public class StepCallbackInvocation {

    @Test
    public void skipped_steps_should_call_callbacks_too() {

        final StepHooks hooks = mock(StepHooks.class);
        successGivenStep().skip(hooks);

        final InOrder inOrder = inOrder(hooks);
        inOrder.verify(hooks).startStep(any(Step.class));
        inOrder.verify(hooks).endStep(any(Step.class), isA(StepResult.Skipped.class));
View Full Code Here

    @Test
    public void should_return_success_to_each_level() {

        final RunNotifier runNotifier = mock(RunNotifier.class);

        new MByHave8Runner(SimpleJunitCompatibleSpec.class).run(runNotifier);

        Description suiteDescription = Description.createSuiteDescription(SimpleJunitCompatibleSpec.class);
        verify(runNotifier).fireTestStarted(suiteDescription);
        verify(runNotifier).fireTestFinished(suiteDescription);
View Full Code Here

        outputWriter.flush();
        return output;
    }

    public final SpecOutput execute(final Writer writer) {
        return execute(new AnsiWriterReporter(writer));
    }
View Full Code Here

        ));
    }

    private String report(final SpecOutput output) {
        final StringWriter outputWriter = new StringWriter();
        final Reporter reporter = new AnsiWriterReporter(outputWriter);
        reporter.report(output);
        return outputWriter.toString();
    }
View Full Code Here

        ));
    }

    private String report(final SpecOutput output) {
        final StringWriter outputWriter = new StringWriter();
        final Reporter reporter = new AnsiWriterReporter(outputWriter);
        reporter.report(output);
        return outputWriter.toString();
    }
View Full Code Here

        assertEquals("Feature: Feature description", featureWith(successScenario()).execute(DummyHooks.DUMMY, Filter.EMPTY_FILTER).getDescription());
    }

    @Test
    public void feature_output_should_carry_the_underlying_scenario_outputs() {
        final FeatureOutput featureOutput = featureWith(successScenario()).execute(DummyHooks.DUMMY, Filter.EMPTY_FILTER);
        assertEquals(1, featureOutput.getScenarios().size());
        assertEquals(ScenarioResult.Success, featureOutput.getScenarios().iterator().next().getResult());
    }
View Full Code Here

        return features.isEmpty() || features.stream().anyMatch(feature -> feature.isExecutable(filter));
    }


    public final SpecOutput execute(final Class<?> testClass, final Reporter reporter, final MByHave8Hooks hooks, final Filter filter) {
        final SpecOutput output = executeHelper(testClass, Feature::execute, hooks, filter);
        reporter.report(output);
        return output;
    }
View Full Code Here

TOP

Related Classes of org.moresbycoffee.mbyhave8.hooks.StepHooks

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.