Package org.moresbycoffee.mbyhave8

Examples of org.moresbycoffee.mbyhave8.Configuration


    public void before_feature_method_should_be_converted_to_hook() throws Exception {
        HookTestSpec.beforeFeature.set(new AtomicBoolean(false));

        final HookTestSpec hookTestSpec = new HookTestSpec();
        final Method[] beforeFeatureMethods = new Method[] { HookTestSpec.class.getDeclaredMethod("beforeFeature", Feature.class) };
        final MByHave8Hooks hook = new HookAnnotations(null, null, beforeFeatureMethods, null, null, null).toMByHaveHook(hookTestSpec);

        hook.startFeature(mock(Feature.class));

        assertTrue(HookTestSpec.beforeFeature.get().get());

    }
View Full Code Here


    public void after_feature_method_should_be_converted_to_hook() throws Exception {
        HookTestSpec.afterFeature.set(new AtomicBoolean(false));

        final HookTestSpec hookTestSpec = new HookTestSpec();
        final Method[] afterFeatureMethods = new Method[] { HookTestSpec.class.getDeclaredMethod("afterFeature", Feature.class, FeatureResult.class) };
        final MByHave8Hooks hook = new HookAnnotations(null, null, null, afterFeatureMethods, null, null).toMByHaveHook(hookTestSpec);

        hook.endFeature(mock(Feature.class), FeatureResult.Success);

        assertTrue(HookTestSpec.afterFeature.get().get());

    }
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

    @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

        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

            final Collection<FeatureOutput> featureOutputs = features.stream()
                    .filter(feature -> feature.isExecutable(filter))
                    .map(feature -> featureExecutor.apply(feature, hooks, filter))
                    .collect(Collectors.toList());
            final SpecResult result = ListExtensions.fold(featureOutputs, SpecResult.Success, (previousResult, item) -> previousResult.addFeatureResult(item.getResult()));
            final SpecOutput output = new SpecOutput(testClass.getName(), result, featureOutputs);
            hooks.endSpecification(this, output);
            return output;
        } else {
            return new SpecOutput(testClass.getName(), SpecResult.Success, Collections.emptyList());
        }

    }
View Full Code Here

            Feature("this is a pending feature",
                Scenario("this is a scenario",
                    given("something", (VoidStepImplementation) () -> { throw new PendingException(); })));
        }};

        final SpecOutput output = spec.execute();

        assertEquals(SpecResult.Pending, output.getResult());
    }
View Full Code Here

            Feature("this is a pending feature",
                    Scenario("this is a scenario",
                            given("something", (VoidStepImplementation) () -> { throw new PendingException(); })));
        }};

        final SpecOutput output = spec.execute();

        assertEquals(SpecResult.Pending, output.getResult());
    }
View Full Code Here

            void whenStepImplementation()  { whenStepVisitedFlag.set(true); }
            void thenStepImplementation()  { thenStepVisitedFlag.set(true); }
        };

        assertFalse(givenStepVisitedFlag.get() || whenStepVisitedFlag.get() || thenStepVisitedFlag.get());
        final SpecOutput output = spec.execute();
        assertTrue(givenStepVisitedFlag.get() && whenStepVisitedFlag.get() && thenStepVisitedFlag.get());

        assertEquals(SpecResult.Success, output.getResult());
    }
View Full Code Here

TOP

Related Classes of org.moresbycoffee.mbyhave8.Configuration

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.