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; }
private java.util.Optional<Requirement> parentRequirementFromPackagePath(TestOutcome testOutcome) { if (testOutcome.getPath() != null) { List<String> storyPathElements = stripStorySuffixFrom(stripRootFrom(pathElements(stripRootPathFrom(testOutcome.getPath())))); return lastRequirementFrom(storyPathElements); } return Optional.empty(); }
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; }
private java.util.Optional<Requirement> featureTagRequirementIn(TestOutcome testOutcome) { List<String> storyPathElements = stripStorySuffixFrom(stripRootFrom(pathElements(stripRootPathFrom(testOutcome.getPath())))); return lastRequirementFrom(storyPathElements); }
public Optional<Requirement> getParentRequirementOf(final TestOutcome testOutcome) { if (testOutcome.getPath() != null) { List<String> storyPathElements = stripStorySuffixFrom(stripRootFrom(pathElements(stripRootPathFrom(testOutcome.getPath())))); return lastRequirementFrom(storyPathElements); } else { return mostSpecificTagRequirementFor(testOutcome); } }
public Optional<Requirement> getParentRequirementOf(final TestOutcome testOutcome) { if (testOutcome.getPath() != null) { List<String> storyPathElements = stripStorySuffixFrom(stripRootFrom(pathElements(stripRootPathFrom(testOutcome.getPath())))); return lastRequirementFrom(storyPathElements); } else { return mostSpecificTagRequirementFor(testOutcome); } }