private List<TestTag> getMatchingCapabilities(List<Requirement> requirements, List<String> storyPathElements) { if (storyPathElements.isEmpty()) { return NO_TEST_TAGS; } else { java.util.Optional<Requirement> matchingRequirement = findMatchingRequirementIn(next(storyPathElements), requirements); if (matchingRequirement.isPresent()) { TestTag thisTag = matchingRequirement.get().asTag(); List<TestTag> remainingTags = getMatchingCapabilities(matchingRequirement.get().getChildren(), tail(storyPathElements)); return concat(thisTag, remainingTags); } else { return NO_TEST_TAGS; } } }
private List<TestTag> getMatchingCapabilities(List<Requirement> requirements, List<String> storyPathElements) { if (storyPathElements.isEmpty()) { return NO_TEST_TAGS; } else { Optional<Requirement> matchingRequirement = findMatchingRequirementIn(next(storyPathElements), requirements); if (matchingRequirement.isPresent()) { TestTag thisTag = matchingRequirement.get().asTag(); List<TestTag> remainingTags = getMatchingCapabilities(matchingRequirement.get().getChildren(), tail(storyPathElements)); return concat(thisTag, remainingTags); } else { return NO_TEST_TAGS; } } }
private List<TestTag> getMatchingCapabilities(List<Requirement> requirements, List<String> storyPathElements) { if (storyPathElements.isEmpty()) { return NO_TEST_TAGS; } else { Optional<Requirement> matchingRequirement = findMatchingRequirementIn(next(storyPathElements), requirements); if (matchingRequirement.isPresent()) { TestTag thisTag = matchingRequirement.get().asTag(); List<TestTag> remainingTags = getMatchingCapabilities(matchingRequirement.get().getChildren(), tail(storyPathElements)); return concat(thisTag, remainingTags); } else { return NO_TEST_TAGS; } } }
public Set<TestTag> getTagsFor(final TestOutcome testOutcome) { // // For the FileSystemRequirements tag provider, the test outcome provides a path, which might be: // - a feature file for Cucumber ("add_an_item.feature"), // - a story file with a path (JBehave) ("stories/manage_items/add_an_item.story") // Set<TestTag> tags = new HashSet<>(); if (testOutcome.getPath() != null) { java.util.Optional<Requirement> matchingRequirement = requirementWithMatchingFeatureFile(testOutcome); if (matchingRequirement.isPresent()) { tags.add(matchingRequirement.get().asTag()); tags.addAll(parentRequirementsOf(matchingRequirement.get().asTag())); } // Strategy used if a full path is provided List<String> storyPathElements = stripRootFrom(pathElements(stripRootPathFrom(testOutcome.getPath()))); tags.addAll(getMatchingCapabilities(getRequirements(), stripStorySuffixFrom(storyPathElements))); if (tags.isEmpty() && storyOrFeatureDescribedIn(storyPathElements).isPresent()) { java.util.Optional<TestTag> matchingRequirementTag = getMatchingRequirementTagsFor(storyOrFeatureDescribedIn(storyPathElements).get()); if (matchingRequirementTag.isPresent()) { tags.add(matchingRequirementTag.get()); tags.addAll(parentRequirementsOf(matchingRequirementTag.get())); } } } return tags; }
public Set<TestTag> getTagsFor(final TestOutcome testOutcome) { Set<TestTag> tags = new HashSet<>(); if (testOutcome.getPath() != null) { List<String> storyPathElements = stripRootFrom(pathElements(stripRootPathFrom(testOutcome.getPath()))); addStoryTagIfPresent(tags, storyPathElements); storyPathElements = stripStorySuffixFrom(storyPathElements); tags.addAll(getMatchingCapabilities(getRequirements(), storyPathElements)); } return tags; }
public Set<TestTag> getTagsFor(final TestOutcome testOutcome) { Set<TestTag> tags = new HashSet<>(); if (testOutcome.getPath() != null) { List<String> storyPathElements = stripRootFrom(pathElements(stripRootPathFrom(testOutcome.getPath()))); addStoryTagIfPresent(tags, storyPathElements); storyPathElements = stripStorySuffixFrom(storyPathElements); tags.addAll(getMatchingCapabilities(getRequirements(), storyPathElements)); } return tags; }