Skip to content

Commit

Permalink
Merge pull request #10 from ccharnkij/fix_includes_examples_tags
Browse files Browse the repository at this point in the history
fix: not found examples tags when running in parallel
  • Loading branch information
wakaleo authored May 21, 2020
2 parents d184a0a + 72178dd commit f153da1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import java.util.function.Supplier;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import java.util.stream.Stream;

import static java.util.Arrays.asList;
import static java.util.stream.Collectors.toList;
Expand Down Expand Up @@ -97,7 +98,9 @@ private List<Tag> scenarioTags(ScenarioDefinition scenario) {
if (Scenario.class.isAssignableFrom(scenario.getClass())) {
return ((Scenario) scenario).getTags();
} else {
return ((ScenarioOutline) scenario).getTags();
return Stream.of(((ScenarioOutline) scenario).getTags(), ((ScenarioOutline) scenario).getExamples()
.stream().flatMap(e -> e.getTags().stream()).collect(toList())).flatMap(Collection::stream)
.collect(Collectors.toList());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,14 @@ public void shouldLoadFeatureAndScenarioTagsOntoCorrectScenarios() throws Except
.tags()));
}

@Test
public void shouldIncludeExamplesTagsOntoScenarios() throws Exception {
WeightedCucumberScenarios weightedCucumberScenarios = new CucumberScenarioLoader(newArrayList(new URI("classpath:samples/tagged_example_tables.feature")), testStatistics).load();

assertThat(weightedCucumberScenarios.scenarios, contains(MatchingCucumberScenario.with()
.featurePath("tagged_example_tables.feature")
.feature("Tagged Tables")
.scenario("This scenario should have two tables")
.tags("@small", "@big")));
}
}

0 comments on commit f153da1

Please sign in to comment.