Examples of ExamplesTable


Examples of org.jbehave.core.model.ExamplesTable

    @Test
    public void shouldPassSilentlyOutputFromSuccessfulScenarios() {
        // Given
        StoryReporter delegate = mock(StoryReporter.class);
        SilentSuccessFilter filter = new SilentSuccessFilter(delegate);
        ExamplesTable examplesTable = new ExamplesTable("|one|two|\n|1|2|\n");
        UUIDExceptionWrapper anException = new UUIDExceptionWrapper(new IllegalArgumentException());
        Story story = new Story();
        GivenStories givenStories = new GivenStories("path/to/story1,path/to/story2");
        List<String> givenStoryPaths = asList("path/to/story1","path/to/story2");
View Full Code Here

Examples of org.jbehave.core.model.ExamplesTable

        }
    }

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

Examples of org.jbehave.core.model.ExamplesTable

        String title = findScenarioTitle(scenarioAsText);
        String scenarioWithoutKeyword = removeStart(scenarioAsText, keywords.scenario()).trim();
        String scenarioWithoutTitle = removeStart(scenarioWithoutKeyword, title);
        scenarioWithoutTitle = startingWithNL(scenarioWithoutTitle);
        Meta meta = findScenarioMeta(scenarioWithoutTitle);
        ExamplesTable examplesTable = findExamplesTable(scenarioWithoutTitle);
        GivenStories givenStories = findScenarioGivenStories(scenarioWithoutTitle);
        if (givenStories.requireParameters()) {
            givenStories.useExamplesTable(examplesTable);
        }
        List<String> steps = findSteps(scenarioWithoutTitle);
View Full Code Here

Examples of org.jbehave.core.model.ExamplesTable

        return scenario.getExamplesTable().getRowCount() > 0 && !scenario.getGivenStories().requireParameters();
    }

    private void runScenariosParametrisedByExamples(RunContext context, Scenario scenario, Lifecycle lifecycle, Meta storyAndScenarioMeta)
            throws Throwable {
        ExamplesTable table = scenario.getExamplesTable();
        reporter.get().beforeExamples(scenario.getSteps(), table);
      Keywords keywords = context.configuration().keywords();
        for (Map<String, String> scenarioParameters : table.getRows()) {
      Meta parameterMeta = parameterMeta(keywords, scenarioParameters);
      if ( !parameterMeta.isEmpty() && !context.filter.allow(parameterMeta) ){
        continue;
      }
            reporter.get().example(scenarioParameters);
View Full Code Here

Examples of org.jbehave.core.model.ExamplesTable

            }
            return false;
        }

        public Object convertValue(String value, Type type) {
            return new ExamplesTable(value, headerSeparator, valueSeparator);
        }
View Full Code Here

Examples of org.jbehave.core.model.ExamplesTable

        return scenarios;
    }

    private Scenario parseScenario(String scenarioAsText) {
        String title = findScenarioTitle(scenarioAsText);
        ExamplesTable examplesTable = findExamplesTable(scenarioAsText);
        List<String> givenStoryPaths = findGivenStoryPaths(scenarioAsText);
        List<String> steps = findSteps(scenarioAsText);
        return new Scenario(title, givenStoryPaths, examplesTable, steps);
    }
View Full Code Here

Examples of org.jbehave.core.model.ExamplesTable

    private ExamplesTable findExamplesTable(String scenarioAsText) {
        Matcher findingTable = patternToPullExamplesTableIntoGroupOne()
                .matcher(scenarioAsText);
        String table = findingTable.find() ? findingTable.group(1).trim() : NONE;
        return new ExamplesTable(table, keywords.examplesTableHeaderSeparator(), keywords.examplesTableValueSeparator());
    }
View Full Code Here

Examples of org.jbehave.core.model.ExamplesTable

        return scenario.getExamplesTable().getRowCount() > 0;
    }

    private void runExamplesTableScenario(
            List<CandidateSteps> candidateSteps, Scenario scenario) {
        ExamplesTable table = scenario.getExamplesTable();
        reporter.beforeExamples(scenario.getSteps(), table);
        for (Map<String, String> tableRow : table.getRows()) {
            reporter.example(tableRow);
            runScenarioSteps(candidateSteps, scenario, tableRow);
        }
        reporter.afterExamples();
    }
View Full Code Here

Examples of org.jbehave.core.model.ExamplesTable

    public void aMethodWithExamplesTable(ExamplesTable args) {
        this.args = args;
    }

    public ExamplesTable aMethodReturningExamplesTable(String value){
      return new ExamplesTable(value);
    }
View Full Code Here

Examples of org.jbehave.core.model.ExamplesTable

        assertThat(converter.accept(ExamplesTable.class), is(true));
        assertThat(converter.accept(WrongType.class), is(false));
        assertThat(converter.accept(mock(Type.class)), is(false));
        Type type = SomeSteps.methodFor("aMethodWithExamplesTable").getGenericParameterTypes()[0];
        String value = "|col1|col2|\n|row11|row12|\n|row21|row22|\n";
        ExamplesTable table = (ExamplesTable) converter.convertValue(value, type);
        assertThat(table.getRowCount(), equalTo(2));
        Map<String, String> row1 = table.getRow(0);
        assertThat(row1.get("col1"), equalTo("row11"));
        assertThat(row1.get("col2"), equalTo("row12"));
        Map<String, String> row2 = table.getRow(1);
        assertThat(row2.get("col1"), equalTo("row21"));
        assertThat(row2.get("col2"), equalTo("row22"));
    }
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.