use of com.trivago.rta.vo.SingleScenario in project cucable-plugin by trivago.
the class GherkinDocumentParserTest method validFeatureWithDataTableTest.
@Test
public void validFeatureWithDataTableTest() throws Exception {
String featureContent = "@featureTag\n" + "Feature: test feature\n" + "\n" + "@scenario1Tag1\n" + "@scenario1Tag2\n" + "Scenario: This is a scenario with two steps\n" + "Given this is step 1\n" + "|value1|value2|\n" + "Then this is step 2\n";
List<SingleScenario> singleScenariosFromFeature = gherkinDocumentParser.getSingleScenariosFromFeature(featureContent, "", null, null, null);
assertThat(singleScenariosFromFeature.size(), is(1));
SingleScenario scenario = singleScenariosFromFeature.get(0);
assertThat(scenario.getScenarioName(), is("Scenario: This is a scenario with two steps"));
assertThat(scenario.getSteps().size(), is(2));
assertThat(scenario.getBackgroundSteps().size(), is(0));
assertThat(scenario.getSteps().get(0).getDataTable(), is(notNullValue()));
assertThat(scenario.getSteps().get(0).getDataTable().getRows().size(), is(1));
assertThat(scenario.getSteps().get(0).getDataTable().getRows().get(0).size(), is(2));
}
use of com.trivago.rta.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, null, 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"));
}
use of com.trivago.rta.vo.SingleScenario in project cucable-plugin by trivago.
the class GherkinDocumentParserTest method validFeatureWithBackgroundScenarioTest.
@Test
public void validFeatureWithBackgroundScenarioTest() throws Exception {
String featureContent = "Feature: FeatureName\n" + "\n" + " Background:\n" + " Given BackgroundGivenStep\n" + " And BackgroundGivenStep2\n" + "\n" + " @tag1\n" + " @tag2\n" + " Scenario: This is a scenario with background\n" + " Then ThenStep";
List<SingleScenario> singleScenariosFromFeature = gherkinDocumentParser.getSingleScenariosFromFeature(featureContent, "", null, null, null);
assertThat(singleScenariosFromFeature.size(), is(1));
SingleScenario scenario = singleScenariosFromFeature.get(0);
assertThat(scenario.getScenarioName(), is("Scenario: This is a scenario with background"));
assertThat(scenario.getSteps().size(), is(1));
assertThat(scenario.getBackgroundSteps().size(), is(2));
assertThat(scenario.getSteps().get(0).getDataTable(), is(nullValue()));
}
Aggregations