@Override public String apply(Tag tag) { return tag.getName(); } }).toList();
@Override public String map(Tag tag) { return tag.getName(); } };
@Override public String apply(Tag input) { return input.getName(); } }).toList();
public boolean eval(Collection<Tag> tags) { for (Tag tag : tags) { if (tagName.equals(tag.getName())) { return true; } } return false; } }
private String findCardNumberInTags(List<Tag> tags) { for(Tag tag : tags) { if (tag.getName().toLowerCase().startsWith("@issue:")) { return tag.getName().replaceAll("@issue:",""); } else if (tag.getName().toLowerCase().startsWith("@issues:")) { String issueNumberList = tag.getName().replaceAll("@issues:", ""); List<String> issueNumberTags = Splitter.on(",").trimResults().omitEmptyStrings().splitToList(issueNumberList); return issueNumberTags.get(0); } } return null; }
/** * Transform tags from Cucumber to RP format * * @param tags - Cucumber tags * @return set of tags */ public static Set<String> extractTags(List<Tag> tags) { Set<String> returnTags = new HashSet<String>(); for (Tag tag : tags) { returnTags.add(tag.getName()); } return returnTags; }
protected boolean isResultTag(final Tag tag) { return Arrays.asList(new String[]{FLAKY, KNOWN, MUTED}) .contains(tag.getName().toUpperCase()); }
private List<String> findVersionNumberInTags(List<Tag> tags) { List<String> versionNumbers = Lists.newArrayList(); for(Tag tag : tags) { if (tag.getName().toLowerCase().startsWith("@version:")) { versionNumbers.add(tag.getName().replaceAll("@version:", "")); } else if (tag.getName().toLowerCase().startsWith("@versions:")) { String versionNumberList = tag.getName().replaceAll("@versions:", ""); List<String> versionNumberTags = Splitter.on(",").trimResults().omitEmptyStrings().splitToList(versionNumberList); versionNumbers.addAll(versionNumberTags); } } return versionNumbers; } }
private void writeMeta(List<Tag> tags) { if (tags.isEmpty()) { return; } out.append(keywords.meta()).append(" "); for (Tag tag : tags) { out.append(tag.getName()).append(" "); } out.append("\n"); }
protected boolean isPureSeverityTag(final Tag tag) { return Arrays.stream(SeverityLevel.values()) .map(SeverityLevel::value) .map(value -> "@" + value) .anyMatch(value -> value.equalsIgnoreCase(tag.getName())); }
public TagDTO(Tag tag) { name = tag.getName(); line = tag.getLine(); }
private Label getTagLabel(final Tag tag) { return createTagLabel(tag.getName().substring(1)); }
private Issues getIssuesAnnotation(Scenario scenario) { List<String> issues = new ArrayList<>(); for (Tag tag : scenario.getTags()) { Matcher matcher = ISSUE_PATTERN.matcher(tag.getName()); if (matcher.matches()) { issues.add(matcher.group(1)); } } return !issues.isEmpty() ? getIssuesAnnotation(issues) : null; }
private TestCaseId getTestCaseIdAnnotation(Scenario scenario) { for (Tag tag : scenario.getTags()) { Matcher matcher = TEST_CASE_ID_PATTERN.matcher(tag.getName()); if (matcher.matches()) { final String testCaseId = matcher.group(1); return new TestCaseId() { @Override public String value() { return testCaseId; } @Override public Class<TestCaseId> annotationType() { return TestCaseId.class; } }; } } return null; }
private SeverityLevel getSeverityLevel(Scenario scenario) { SeverityLevel level = null; List<SeverityLevel> severityLevels = Arrays.asList( SeverityLevel.BLOCKER, SeverityLevel.CRITICAL, SeverityLevel.NORMAL, SeverityLevel.MINOR, SeverityLevel.TRIVIAL); for (Tag tag : scenario.getTags()) { Matcher matcher = SEVERITY_PATTERN.matcher(tag.getName()); if (matcher.matches()) { SeverityLevel levelTmp; String levelString = matcher.group(1); try { levelTmp = SeverityLevel.fromValue(levelString.toLowerCase()); } catch (IllegalArgumentException e) { LOG.warn(String.format("Unexpected Severity level [%s]. SeverityLevel.NORMAL will be used instead", levelString), e); levelTmp = SeverityLevel.NORMAL; } if (level == null || severityLevels.indexOf(levelTmp) < severityLevels.indexOf(level)) { level = levelTmp; } } } return level; }
public void feature(Feature feature) { if (LOG.isLoggable(Level.FINE)) { LOG.log(Level.FINE, "Feature: " + feature.getKeyword() + feature.getName()); List<Tag> tags = feature.getTags(); for (Tag tag : tags) { LOG.log(Level.FINE, " " + tag.getName()); } LOG.log(Level.FINE, " " + feature.getDescription()); } // a new feature being received signals the end of the previous feature currentFeatureResult = new FeatureResult(currentURI, feature); currentURI = null; testResult.addFeatureResult(currentFeatureResult); }
public void scenario(Scenario scenario) { if (LOG.isLoggable(Level.FINE)) { LOG.log(Level.FINE, "Scenario: " + scenario.getKeyword() + " " + scenario.getName()); List<Tag> tags = scenario.getTags(); for (Tag tag : tags) { LOG.log(Level.FINE, " " + tag.getName()); } LOG.log(Level.FINE, " " + scenario.getDescription()); LOG.log(Level.FINE, " " + scenario.getComments()); } // a new scenario signifies that the previous scenario has been handled. currentScenarioResult = new ScenarioResult(scenario, currentBackground); currentBackground = null; currentFeatureResult.addScenarioResult(currentScenarioResult); }
private StringBuilder addTagStatement(StringBuilder sb, TagStatement tagStatement) { for (Comment comment : tagStatement.getComments()) { addComment(sb, comment); } for (Tag tag : tagStatement.getTags()) { createLine(sb, tag.getLine(), RESULT_TYPE.NO_RESULT); sb.append(tag.getName()); } createLine(sb, tagStatement.getLine(), RESULT_TYPE.NO_RESULT); appendKeyword(sb, tagStatement.getKeyword()).append(' ').append(tagStatement.getName()); String descr = tagStatement.getDescription(); indent++; if (descr != null && !descr.isEmpty()) { // may have been run on windows? descr = descr.replace("\r\n", "\n"); String[] lines = descr.split("\\n"); for (int i=0; i < lines.length; i++){ endLine(sb); createLine(sb, tagStatement.getLine() + i+1, RESULT_TYPE.NO_RESULT); sb.append("<span style=\"font-style:italic\">"); sb.append(lines[i]); sb.append("</span>"); } } endLine(sb); return sb; }
final Tag tag = tags.remove(); final String tagString = tag.getName();