Package org.moresbycoffee.mbyhave8

Examples of org.moresbycoffee.mbyhave8.MByHaveSpec


        assertThat(errorWhenStep().execute(DummyStepHooks.DUMMY).getResult(), instanceOf(StepResult.Error.class));
    }

    @Test
    public void implementationLess_when_step_should_return_pending_state() {
        final Step step = new MByHaveSpec() {
            Step innerStep = when("Implementationless Step");
        }.innerStep;

        final StepOutput stepOutput = step.execute(DummyStepHooks.DUMMY);
View Full Code Here


    public void second_step_should_not_run_after_a_failing_step() {

        final AtomicBoolean isWhenVisited = new AtomicBoolean(false);
        final AtomicBoolean isThenVisited = new AtomicBoolean(false);

        final Scenario scenario = new MByHaveSpec() {
            Scenario scenario = Scenario("scenario description",
                    given("given step", (VoidStepImplementation) () -> { throw new AssertionError(); }),
                    when("when step", () -> { isWhenVisited.set(true); }),
                    then("then step", () -> { isThenVisited.set(true); }));
        }.scenario;
View Full Code Here

        assertThat(stepOutput.getResult(), instanceOf(StepResult.Error.class));
    }

    @Test
    public void implementationLess_then_step_should_return_pending_state() {
        final Step step = new MByHaveSpec() {
            Step innerStep = then("Implementationless Step");
        }.innerStep;

        final StepOutput stepOutput = step.execute(DummyStepHooks.DUMMY);
View Full Code Here

*/
public class Spec_execution_Test {

    @Test
    public void should_return_SUCCESS_when_the_only_features_result_is_succes() {
        final MByHaveSpec spec = new MByHaveSpec() {{
            Feature("this is a feature without runner",
                    Scenario("this is a scenario",
                            given("something", () -> {})));
        }};

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

        assertEquals(SpecResult.Success, spec.execute().getResult());
    }

    @Test
    public void should_return_the_name_of_the_class_in_the_spec_output() {
        final MByHaveSpec spec = new MByHaveSpec() {{
            Feature("this is a feature without runner",
                    Scenario("this is a scenario",
                            given("something", () -> {
                            })));
        }};

        assertThat(spec.execute().getTestClassName(), startsWith(this.getClass().getName()));
    }
View Full Code Here

        assertThat(spec.execute().getTestClassName(), startsWith(this.getClass().getName()));
    }

    @Test
    public void should_return_the_outputs_of_the_underlying_features() {
        final MByHaveSpec spec = new MByHaveSpec() {{
            Feature("this is a feature without runner",
                    Scenario("this is a scenario",
                            given("something", () -> {
                            })));
        }};

        final SpecOutput output = spec.execute();

        assertEquals(1, output.getFeatures().size());
        assertEquals(FeatureResult.Success, output.getFeatures().iterator().next().getResult());

    }
View Full Code Here

    }

    @Test
    public void should_not_execute_not_executable_features() {
        final MByHaveSpec spec = new MByHaveSpec() {{
            Feature("this is a feature without runner",
                Scenario("this is a scenario",
                    given("something", () -> {})
                )
            ).tag("Broken");
        }};

        final SpecOutput output = spec.getSpecification().execute(
                spec.getClass(), new NullReporter(), new CallbackAnnouncer(),
                new Filter("~Broken"));

        assertEquals(0, output.getFeatures().size());
    }
View Full Code Here

    @Test
    public void feature_with_one_scenario_and_one_PENDING_step_should_be_PENDING() {
        final MByHaveSpec spec = new MByHaveSpec() {{
            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

                            given("something", () -> { })));


            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

    @Test
    public void before_spec_method_should_be_converted_to_hook() throws Throwable {
        HookTestSpec.beforeSpec.set(new AtomicBoolean(false));

        final HookTestSpec hookTestSpec = new HookTestSpec();
        final Method[] beforeSpecMethods = new Method[] { HookTestSpec.class.getDeclaredMethod("beforeSpecification", Specification.class) };
        final MByHave8Hooks hook = new HookAnnotations(beforeSpecMethods, null, null, null, null, null).toMByHaveHook(hookTestSpec);

        hook.startSpecification(mock(Specification.class));
View Full Code Here

TOP

Related Classes of org.moresbycoffee.mbyhave8.MByHaveSpec

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.