use of com.trivago.vo.SingleScenario in project cucable-plugin by trivago.
the class GherkinDocumentParserTest method validFeatureWithScenarioOutlineTest.
@Test
public void validFeatureWithScenarioOutlineTest() throws Exception {
String featureContent = "Feature: test feature 3\n" + "\n" + " Scenario Outline: This is a scenario outline\n" + " When I search for key <key>\n" + " Then I see the value '<value>'\n" + "\n" + " Examples:\n" + " | key | value |\n" + " | 1 | one |\n" + " | 2 | two |";
List<SingleScenario> singleScenariosFromFeature = gherkinDocumentParser.getSingleScenariosFromFeature(featureContent, "", null);
assertThat(singleScenariosFromFeature.size(), is(2));
SingleScenario scenario = singleScenariosFromFeature.get(0);
assertThat(scenario.getScenarioName(), is("Scenario: This is a scenario outline"));
assertThat(scenario.getSteps().size(), is(2));
assertThat(scenario.getBackgroundSteps().size(), is(0));
assertThat(scenario.getSteps().get(0).getDataTable(), is(nullValue()));
assertThat(scenario.getSteps().get(0).getName(), is("When I search for key 1"));
assertThat(scenario.getSteps().get(1).getName(), is("Then I see the value 'one'"));
scenario = singleScenariosFromFeature.get(1);
assertThat(scenario.getScenarioName(), is("Scenario: This is a scenario outline"));
assertThat(scenario.getSteps().size(), is(2));
assertThat(scenario.getBackgroundSteps().size(), is(0));
assertThat(scenario.getSteps().get(0).getDataTable(), is(nullValue()));
assertThat(scenario.getSteps().get(0).getName(), is("When I search for key 2"));
assertThat(scenario.getSteps().get(1).getName(), is("Then I see the value 'two'"));
}
use of com.trivago.vo.SingleScenario in project cucable-plugin by trivago.
the class GherkinDocumentParserTest method replaceDataTableExamplePlaceholderTest.
@Test
public void replaceDataTableExamplePlaceholderTest() throws Exception {
String featureContent = "Feature: test feature 3\n" + "\n" + " Scenario Outline: This is a scenario outline\n" + " When I search for key <key>\n" + " | test | <key> | <value> |" + "\n" + " Examples:\n" + " | key | value |\n" + " | 1 | one |\n";
List<SingleScenario> singleScenariosFromFeature = gherkinDocumentParser.getSingleScenariosFromFeature(featureContent, "", null);
assertThat(singleScenariosFromFeature.size(), is(1));
assertThat(singleScenariosFromFeature.get(0).getSteps().size(), is(1));
DataTable dataTable = singleScenariosFromFeature.get(0).getSteps().get(0).getDataTable();
assertThat(dataTable.getRows().size(), is(1));
List<String> firstRow = dataTable.getRows().get(0);
assertThat(firstRow.get(0), is("test"));
assertThat(firstRow.get(1), is("1"));
assertThat(firstRow.get(2), is("one"));
}
use of com.trivago.vo.SingleScenario in project cucable-plugin by trivago.
the class GherkinDocumentParserTest method validScenarioNamesWithScenarioOutlineTest.
@Test
public void validScenarioNamesWithScenarioOutlineTest() throws Exception {
String featureContent = "Feature: test feature 3\n" + "\n" + " Scenario Outline: This is a scenario outline, key = <key>, value = <value>\n" + " This is a step\n" + " How about another step\n" + "\n" + " Examples:\n" + " | key | value |\n" + " | 1 | one |\n" + " | 2 | two |";
List<SingleScenario> singleScenariosFromFeature = gherkinDocumentParser.getSingleScenariosFromFeature(featureContent, "", null);
assertThat(singleScenariosFromFeature.size(), is(2));
SingleScenario scenario = singleScenariosFromFeature.get(0);
assertThat(scenario.getScenarioName(), is("Scenario: This is a scenario outline, key = 1, value = one"));
scenario = singleScenariosFromFeature.get(1);
assertThat(scenario.getScenarioName(), is("Scenario: This is a scenario outline, key = 2, value = two"));
}
Aggregations