diff --git a/serenity-model/src/main/java/net/thucydides/core/model/TestTag.java b/serenity-model/src/main/java/net/thucydides/core/model/TestTag.java index 1ffdce6b3a..d3067a2589 100644 --- a/serenity-model/src/main/java/net/thucydides/core/model/TestTag.java +++ b/serenity-model/src/main/java/net/thucydides/core/model/TestTag.java @@ -11,6 +11,7 @@ public class TestTag implements Comparable { public static final TestTag EMPTY_TAG = new TestTag("",""); + public static final String DEFAULT_TAG_TYPE = "tag"; private final String name; private final String type; @@ -79,7 +80,7 @@ public static TestTag withValue(String value) { } else if (value.contains("=")) { return getTestTag(value, value.indexOf("=")); } else { - return TestTag.withName(value.trim()).andType("tag"); + return TestTag.withName(value.trim()).andType(DEFAULT_TAG_TYPE); } } diff --git a/serenity-model/src/main/java/net/thucydides/core/requirements/model/Requirement.java b/serenity-model/src/main/java/net/thucydides/core/requirements/model/Requirement.java index 2bf3d020a8..04fc332eaf 100644 --- a/serenity-model/src/main/java/net/thucydides/core/requirements/model/Requirement.java +++ b/serenity-model/src/main/java/net/thucydides/core/requirements/model/Requirement.java @@ -14,6 +14,7 @@ import java.util.stream.Collectors; import java.util.stream.Stream; +import static net.thucydides.core.model.TestTag.DEFAULT_TAG_TYPE; import static org.apache.commons.lang3.StringUtils.isEmpty; /** @@ -436,6 +437,12 @@ public Requirement withTags(List tags) { } public Requirement withScenarioTags(Map> scenarioTags) { + if(!tags.isEmpty() && this.scenarioTags.isEmpty()) { + List testTags = tags.stream().filter(testTag -> DEFAULT_TAG_TYPE.equals(testTag.getType())).collect(Collectors.toList()); + for (Collection currentScenarioTag : scenarioTags.values()) { + currentScenarioTag.addAll(testTags); + } + } return new Requirement(this.name, this.id, this.displayName, this.cardNumber, parent, this.type, this.path, this.narrative, children, examples, releaseVersions, customFields, featureFileName, this.tags, scenarioTags, containsNoScenarios); } diff --git a/serenity-reports/src/main/java/net/thucydides/core/reports/html/HtmlAggregateStoryReporter.java b/serenity-reports/src/main/java/net/thucydides/core/reports/html/HtmlAggregateStoryReporter.java index 4c36c308bf..d18edd9cc7 100644 --- a/serenity-reports/src/main/java/net/thucydides/core/reports/html/HtmlAggregateStoryReporter.java +++ b/serenity-reports/src/main/java/net/thucydides/core/reports/html/HtmlAggregateStoryReporter.java @@ -277,7 +277,7 @@ public void setJiraUsername(String jiraUsername) { } public void setTags(String tags) { - this.tags = tags; + this.tags = (tags != null) ? tags.replaceAll("\\s+((or)|(OR))\\s+",",") : null; } public void setJiraPassword(String jiraPassword) {