Examples of ExamplesTable


Examples of org.jbehave.core.model.ExamplesTable

            outcomesTable.verify();
        } catch (UUIDExceptionWrapper e) {
            reporter.failedOutcomes("Then I don't return loan", ((OutcomesFailed)e.getCause()).outcomesTable());
        }
        reporter.notPerformed("Then I should have $20");
        ExamplesTable table = new ExamplesTable("|money|to|\n|$30|Mauro|\n|$50|Paul|\n");
        reporter.beforeExamples(asList("Given money <money>", "Then I give it to <to>"), table);
        reporter.example(table.getRow(0));
        reporter.example(table.getRow(1));
        reporter.afterExamples();
        reporter.afterScenario();

        // 3rd scenario
        reporter.beforeScenario("A pending scenario");
View Full Code Here

Examples of org.jbehave.core.model.ExamplesTable

        } catch (UUIDExceptionWrapper e) {
            reporter.failedOutcomes("Then I don't return loan", ((OutcomesFailed) e.getCause()).outcomesTable());
        }
        reporter.afterScenario();
        reporter.beforeScenario("Parametrised Scenario");
        ExamplesTable table = new ExamplesTable("|money|to|\n|$30|Mauro|\n|$50|Paul|\n");
        reporter.beforeExamples(asList("Given money <money>", "Then I give it to <to>"), table);
        reporter.example(table.getRow(0));
        reporter.successful("Given money $30");
        reporter.successful("Then I give it to Mauro");
        reporter.example(table.getRow(1));
        reporter.successful("Given money $50");
        reporter.successful("Then I give it to Paul");
        if (withFailure) {
            reporter.failed("Then I should have a balance of $30", new Exception("Expected <30> got <25>"));
        } else {
View Full Code Here

Examples of org.jbehave.core.model.ExamplesTable

        if (containsTable(text)) {
            String tableStart = format(PARAMETER_TABLE_START, PARAMETER_TABLE_START);
            String tableEnd = format(PARAMETER_TABLE_END, PARAMETER_TABLE_END);
            String tableAsString = substringBetween(text, tableStart, tableEnd);
            output.print(text
                    .replace(tableAsString, formatTable(new ExamplesTable(tableAsString)))
                    .replace(tableStart, format("parameterValueStart", EMPTY))
                    .replace(tableEnd, format("parameterValueEnd", EMPTY))
                    .replace(format(PARAMETER_VALUE_START, PARAMETER_VALUE_START), format("parameterValueStart", EMPTY))
                    .replace(format(PARAMETER_VALUE_END, PARAMETER_VALUE_END), format("parameterValueEnd", EMPTY))
                    .replace(format(PARAMETER_VALUE_NEWLINE, PARAMETER_VALUE_NEWLINE),
View Full Code Here

Examples of org.jbehave.core.model.ExamplesTable

  }

  private void assertThatExamplesTableIsConverted(
      final ParameterConverters parameterConverters) {
    final String tableAsString = "||one||two||\n" + "|1|2|";
    final ExamplesTable table = new ExamplesTable(tableAsString);
    assertThat(table.getHeaders(), hasItems("one", "two"));
  }
View Full Code Here

Examples of org.jbehave.core.model.ExamplesTable

        assertThat(scenario.getSteps(), equalTo(asList(
                "Given a step with a <one>",
                "When I run the scenario of name <two>",
                "Then I should see <three> in the output"
        )));
        ExamplesTable table = scenario.getExamplesTable();
        assertThat(table.asString(), equalTo(
                "|one|two|three|" + NL +
                        "|11|12|13|" + NL +
                        "|21|22|23|" + NL));
        assertThat(table.getRowCount(), equalTo(2));
        assertThat(table.getRow(0), not(nullValue()));
        assertThat(table.getRow(0).get("one"), equalTo("11"));
        assertThat(table.getRow(0).get("two"), equalTo("12"));
        assertThat(table.getRow(0).get("three"), equalTo("13"));
        assertThat(table.getRow(1), not(nullValue()));
        assertThat(table.getRow(1).get("one"), equalTo("21"));
        assertThat(table.getRow(1).get("two"), equalTo("22"));
        assertThat(table.getRow(1).get("three"), equalTo("23"));
    }
View Full Code Here

Examples of org.jbehave.core.model.ExamplesTable

    public void shouldJustDelegateAllReportingMethodsOtherThanFailure() {
        // Given
        Story story = new Story();
        boolean givenStory = false;
        List<String> steps = asList("Given step <one>", "Then step <two>");
        ExamplesTable table = new ExamplesTable("|one|two|\n |1|2|\n");
        Map<String, String> tableRow = table.getRow(0);

        // When
        decorator.dryRun();
        decorator.beforeStory(story, givenStory);
        decorator.beforeScenario("My core 1");
View Full Code Here

Examples of org.jbehave.core.model.ExamplesTable

        // Given
        StoryReporter delegate = mock(StoryReporter.class);
        DelegatingStoryReporter delegator = new DelegatingStoryReporter(delegate);
        List<String> givenStoryPaths = asList("path/to/story1", "path/to/story2");
        GivenStories givenStories = new GivenStories(StringUtils.join(givenStoryPaths, ","));
        ExamplesTable examplesTable = new ExamplesTable("|one|two|\n|1|2|\n");
        UUIDExceptionWrapper anException = new UUIDExceptionWrapper(new IllegalArgumentException());
        Story story = new Story();
        boolean givenStory = false;
        Scenario scenario = new Scenario();
        String filter = "-some property";
       
        // When
        delegator.dryRun();
       
        delegator.beforeStory(story, givenStory);       
        delegator.storyNotAllowed(story, filter);
        delegator.beforeScenario("My scenario 1");
        delegator.scenarioNotAllowed(scenario, filter);
        delegator.scenarioMeta(Meta.EMPTY);
        delegator.givenStories(givenStoryPaths);
        delegator.givenStories(givenStories);
        delegator.successful("Given step 1.1");
        delegator.ignorable("!-- ignore me");
        delegator.pending("When step 1.2");
        delegator.notPerformed("Then step 1.3");
        delegator.beforeExamples(asList("Given step <one>", "Then step <two>"), examplesTable);
        delegator.example(examplesTable.getRow(0));
        delegator.afterExamples();
        delegator.afterScenario();
      
        delegator.beforeScenario("My scenario 2");
        delegator.successful("Given step 2.1");
        delegator.successful("When step 2.2");
        delegator.failed("Then step 2.3", anException);
        delegator.afterScenario();
       
        delegator.afterStory(givenStory);
       
        // Then       
        assertThat(delegator.toString(), containsString(delegate.toString()));
       
        InOrder inOrder = inOrder(delegate);
               
        inOrder.verify(delegate).dryRun();       

        inOrder.verify(delegate).beforeStory(story, givenStory);
        inOrder.verify(delegate).storyNotAllowed(story, filter);
       
        inOrder.verify(delegate).beforeScenario("My scenario 1");
        inOrder.verify(delegate).scenarioNotAllowed(scenario, filter);
        inOrder.verify(delegate).scenarioMeta(Meta.EMPTY);
        inOrder.verify(delegate).givenStories(givenStoryPaths);
        inOrder.verify(delegate).givenStories(givenStories);
        inOrder.verify(delegate).successful("Given step 1.1");
        inOrder.verify(delegate).ignorable("!-- ignore me");
        inOrder.verify(delegate).pending("When step 1.2");
        inOrder.verify(delegate).notPerformed("Then step 1.3");
        inOrder.verify(delegate).beforeExamples(asList("Given step <one>", "Then step <two>"), examplesTable);
        inOrder.verify(delegate).example(examplesTable.getRow(0));
        inOrder.verify(delegate).afterExamples();
        inOrder.verify(delegate).afterScenario();
       
        inOrder.verify(delegate).beforeScenario("My scenario 2");
        inOrder.verify(delegate).successful("Given step 2.1");
View Full Code Here

Examples of org.jbehave.core.model.ExamplesTable

    }

    @Test
    public void shouldRunScenarioWithExamplesTable() throws Throwable {
        // Given
        ExamplesTable examplesTable = new ExamplesTable("|one|two|\n|1|2|\n");
        Map<String, String> tableRow = examplesTable.getRow(0);
        Scenario scenario1 = new Scenario("my title 1", Meta.EMPTY, GivenStories.EMPTY, examplesTable, asList("step <one>",
                "step <two>"));
        Story story = new Story(new Description("my blurb"), Narrative.EMPTY, asList(scenario1));
        Step step = mock(Step.class);
        StepResult result = mock(StepResult.class);
View Full Code Here

Examples of org.jbehave.core.model.ExamplesTable

    }

    @Test
    public void shouldRunScenarioAndLifecycleStepsInCorrectOrderWithExamplesTable() throws Throwable{
        // Given
        ExamplesTable examplesTable = new ExamplesTable("|one|two|\n|1|2|\n|3|4|\n");
        Map<String, String> tableRow1 = examplesTable.getRow(0);
        Map<String, String> tableRow2 = examplesTable.getRow(1);
        Scenario scenario1 = new Scenario("my title 1", Meta.EMPTY, GivenStories.EMPTY, examplesTable, asList("step <one>",
                "step <two>"));
        Story story = new Story(new Description("my blurb"), Narrative.EMPTY, asList(scenario1));
        StoryReporter reporter = mock(ConcurrentStoryReporter.class);
        StepCollector collector = mock(StepCollector.class);
View Full Code Here

Examples of org.jbehave.core.model.ExamplesTable

        }

        private void parseTableAsString() {
            if (step.contains(PARAMETER_TABLE_START) && step.contains(PARAMETER_TABLE_END)) {
                tableAsString = StringUtils.substringBetween(step, PARAMETER_TABLE_START, PARAMETER_TABLE_END);
                table = new ExamplesTable(tableAsString);
            }
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.