use of gherkin.formatter.model.ExamplesTableRow in project cucumber-jvm by cucumber.
the class CucumberScenarioOutlineTest method replaces_tokens_in_data_tables.
@Test
public void replaces_tokens_in_data_tables() {
List<DataTableRow> rows = asList(new DataTableRow(C, asList("I", "have <n> cukes"), 1));
Step outlineStep = new Step(C, null, "I have <n> cukes", 0, rows, null);
Step exampleStep = CucumberScenarioOutline.createExampleStep(outlineStep, new ExamplesTableRow(C, asList("n"), 1, ""), new ExamplesTableRow(C, asList("10"), 1, ""));
assertEquals(asList("I", "have 10 cukes"), exampleStep.getRows().get(0).getCells());
}
use of gherkin.formatter.model.ExamplesTableRow in project cucumber-jvm by cucumber.
the class CucumberScenarioOutlineTest method replaces_tokens_in_doc_strings.
@Test
public void replaces_tokens_in_doc_strings() {
Step outlineStep = new Step(C, null, "I have <n> cukes", 0, null, new DocString(null, "I have <n> cukes", 1));
Step exampleStep = CucumberScenarioOutline.createExampleStep(outlineStep, new ExamplesTableRow(C, asList("n"), 1, ""), new ExamplesTableRow(C, asList("10"), 1, ""));
assertEquals("I have 10 cukes", exampleStep.getDocString().getValue());
}
use of gherkin.formatter.model.ExamplesTableRow in project cucumber-jvm by cucumber.
the class CucumberScenarioOutlineTest method allows_data_table_entries_to_be_empty_after_replacement.
@Test
public void allows_data_table_entries_to_be_empty_after_replacement() {
List<DataTableRow> rows = asList(new DataTableRow(C, asList("<entry>"), 1));
Step outlineStep = new Step(C, null, "Some step", 0, rows, null);
Step exampleStep = CucumberScenarioOutline.createExampleStep(outlineStep, new ExamplesTableRow(C, asList("entry"), 1, ""), new ExamplesTableRow(C, asList(""), 1, ""));
assertEquals(asList(""), exampleStep.getRows().get(0).getCells());
}
use of gherkin.formatter.model.ExamplesTableRow in project cucumber-jvm by cucumber.
the class CucumberExamplesTest method should_create_example_scenarios.
@Test
public void should_create_example_scenarios() {
CucumberFeature cucumberFeature = new CucumberFeature(new Feature(COMMENTS, FEATURE_TAGS, "Feature", "", "", 2, "fid"), "f.feature");
ScenarioOutline so = new ScenarioOutline(COMMENTS, SO_TAGS, "Scenario Outline", "", "", 4, "");
CucumberScenarioOutline cso = new CucumberScenarioOutline(cucumberFeature, null, so);
cso.step(new Step(COMMENTS, "Given ", "I have 5 <what> in my <where>", 5, null, null));
Examples examples = new Examples(COMMENTS, E_TAGS, "Examples", "", "", 6, "", asList(new ExamplesTableRow(COMMENTS, asList("what", "where"), 7, ""), new ExamplesTableRow(COMMENTS, asList("cukes", "belly"), 8, ""), new ExamplesTableRow(COMMENTS, asList("apples", "basket"), 9, "")));
CucumberExamples cucumberExamples = new CucumberExamples(cso, examples);
List<CucumberScenario> exampleScenarios = cucumberExamples.createExampleScenarios();
assertEquals(2, exampleScenarios.size());
Set<Tag> expectedTags = new HashSet<Tag>();
expectedTags.addAll(FEATURE_TAGS);
expectedTags.addAll(SO_TAGS);
expectedTags.addAll(E_TAGS);
assertEquals(expectedTags, exampleScenarios.get(0).tagsAndInheritedTags());
CucumberScenario cucumberScenario = exampleScenarios.get(0);
Step step = cucumberScenario.getSteps().get(0);
assertEquals("I have 5 cukes in my belly", step.getName());
}
use of gherkin.formatter.model.ExamplesTableRow in project cucumber-jvm by cucumber.
the class CucumberScenarioOutlineTest method does_not_allow_the_step_to_be_empty_after_replacement.
@Test(expected = CucumberException.class)
public void does_not_allow_the_step_to_be_empty_after_replacement() {
Step outlineStep = new Step(C, null, "<step>", 0, null, null);
CucumberScenarioOutline.createExampleStep(outlineStep, new ExamplesTableRow(C, asList("step"), 1, ""), new ExamplesTableRow(C, asList(""), 1, ""));
}
Aggregations