@Test public void testExtractScenarios() throws IOException { List<Feature> features = CucumberReportUtil.parseReportJson(TestUtil.loadUtf8ResourceAsString("reports/tests/dry-report.json")); List<Scenario> scenarios = ScenarioExtractorUtil.extractScenarios(new Source().withCode("B"), features); assertThat(scenarios.size()).isEqualTo(19); assertScenario1(scenarios.get(0)); assertScenario2(scenarios.get(1)); assertScenarioWithoutTag(scenarios.get(12)); assertThat(scenarios.get(0).isIgnored()).isTrue(); assertThat(scenarios.get(11).isIgnored()).isTrue(); assertThat(scenarios.get(13).getCountryCodes()).isEqualTo("nl"); assertThat(scenarios.get(5).getCountryCodes()).isEqualTo("nl"); assertThat(scenarios.get(2).getCountryCodes()).isEqualTo("nl"); assertThat(scenarios.get(3).getCountryCodes()).isEqualTo("be,nl"); assertThat(scenarios.get(4).getCountryCodes()).isEqualTo("all"); assertThat(scenarios.get(13).getSeverity()).isEqualTo("high"); assertThat(scenarios.get(0).getSeverity()).isEqualTo("sanity-check"); assertThat(scenarios.get(14).getSeverity()).isEqualTo("high"); assertThat(scenarios.get(16).getContent()).isEqualTo("" + "0:element:Background:\n" + "6:skipped:0:Given A step that works\n" + "7:skipped:0:And A step number 1 that fails with error \"bad-background\"\n" + "0:element:Scenario:\n" + "11:skipped:0:Given A step that works"); assertThat(scenarios.get(18).getContent()).isEqualTo("" + "4:skipped:0:Given A doc string:\n" + "4:skipped:\"\"\"\n" + "4:skipped:Line 1\n" + "4:skipped:Line 2\n" + "4:skipped:\"\"\"\n" + "9:skipped:0:When A doc string:\n" + "9:skipped:\"\"\"ruby\n" + "9:skipped:# With content type\n" + "9:skipped:\"\"\""); }
public static List<Scenario> extractScenarios(Source source, List<Feature> features) { List<Scenario> scenarios = new ArrayList<>(); Scenario lastBackground = null; for (Feature feature : features) { for (Element element : feature.getElements()) { if (element.isBackground()) { lastBackground = extractBackground(element); } else if (element.isScenario() && element.isSingleScenarioOrFirstOfOutline()) { scenarios.add(extractScenario(source, feature, element, lastBackground)); lastBackground = null; } } lastBackground = null; } return scenarios; }
ScenarioExtractorUtil { public static List<Scenario> extractScenarios(Source source, List<Feature> features) { List<Scenario> scenarios = new ArrayList<>(); Scenario lastBackground = null; for (Feature feature : features) { for (Element element : feature.getElements()) { if (element.isBackground()) { lastBackground = extractBackground(element); } else if (element.isScenario() && element.isSingleScenarioOrFirstOfOutline()) { scenarios.add(extractScenario(source, feature, element, lastBackground)); lastBackground = null; } } lastBackground = null; } return scenarios; } }
ScenarioExtractorUtil { public static List<Scenario> extractScenarios(Source source, List<Feature> features) { List<Scenario> scenarios = new ArrayList<>(); Scenario lastBackground = null; for (Feature feature : features) { for (Element element : feature.getElements()) { if (element.isBackground()) { lastBackground = extractBackground(element); } else if (element.isScenario() && element.isSingleScenarioOrFirstOfOutline()) { scenarios.add(extractScenario(source, feature, element, lastBackground)); lastBackground = null; } } lastBackground = null; } return scenarios; }  }
ScenarioExtractorUtil { public static List<Scenario> extractScenarios(Source source, List<Feature> features) { List<Scenario> scenarios = new ArrayList<>(); Scenario lastBackground = null; for (Feature feature : features) { for (Element element : feature.getElements()) { if (element.isBackground()) { lastBackground = extractBackground(element); } else if (element.isScenario() && element.isSingleScenarioOrFirstOfOutline()) { scenarios.add(extractScenario(source, feature, element, lastBackground)); lastBackground = null; } } lastBackground = null; } return scenarios; }  static List<Scenario> extractScenarios(Source source, List<Feature> features); static List<Long> extractFunctionalityIds(String scenarioName); static List<String> extractWrongFunctionalityIds(String scenarioName, Collection<Functionality> functionalities); static String removeFunctionalitiesFromScenarioCucumberId(String cucumberId); static String removeFunctionalitiesFromScenarioName(String name); }
ScenarioExtractorUtil { public static List<Scenario> extractScenarios(Source source, List<Feature> features) { List<Scenario> scenarios = new ArrayList<>(); Scenario lastBackground = null; for (Feature feature : features) { for (Element element : feature.getElements()) { if (element.isBackground()) { lastBackground = extractBackground(element); } else if (element.isScenario() && element.isSingleScenarioOrFirstOfOutline()) { scenarios.add(extractScenario(source, feature, element, lastBackground)); lastBackground = null; } } lastBackground = null; } return scenarios; }  static List<Scenario> extractScenarios(Source source, List<Feature> features); static List<Long> extractFunctionalityIds(String scenarioName); static List<String> extractWrongFunctionalityIds(String scenarioName, Collection<Functionality> functionalities); static String removeFunctionalitiesFromScenarioCucumberId(String cucumberId); static String removeFunctionalitiesFromScenarioName(String name);  }