Java源码示例:ru.yandex.qatools.allure.annotations.Issues

示例1
public List<Link> getLinks() {
    final Method method = getMethod();
    final List<Link> links = new ArrayList<>();
    links.addAll(Allure1Utils.getLinks(method, TestCaseId.class, Allure1Utils::createLinks));
    links.addAll(Allure1Utils.getLinks(method, Issue.class, Allure1Utils::createLinks));
    links.addAll(Allure1Utils.getLinks(method, Issues.class, Allure1Utils::createLinks));
    return links;
}
 
示例2
@Title("testcase")
@Description("testcase description")
@Issue("ISSUE-2")
@Issues(@Issue("ISSUE-22"))
@TestCaseId("TEST-1")
@Stories("story2")
@Features("feature2")
@Severity(SeverityLevel.CRITICAL)
@org.testng.annotations.Test
public void testSomething() {
    parameterWithoutName = "testValue1";
    parameterWithName = "testValue2";
}
 
示例3
@Title("testcase")
@Description("testcase description")
@Issue("ISSUE-2")
@Issues(@Issue("ISSUE-22"))
@TestCaseId("TEST-1")
@Stories("story2")
@Features("feature2")
@Severity(SeverityLevel.CRITICAL)
@org.junit.Test
public void testSomething() {
    parameterWithoutName = "testValue1";
    parameterWithName = "testValue2";
}
 
示例4
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;
}
 
示例5
private Issues getIssuesAnnotation(List<String> issues) {
    final Issue[] values = createIssuesArray(issues);
    return new Issues() {
        @Override
        public Issue[] value() {
            return values;
        }

        @Override
        public Class<Issues> annotationType() {
            return Issues.class;
        }
    };
}
 
示例6
/**
 * Find {@link ru.yandex.qatools.allure.annotations.Issues} annotation and return respective key
 *
 * @return issue keys or empty array if annotation isn't present
 */
public String[] getIssueKeys() {
    Issues issues = getAnnotation(Issues.class);
    if (issues == null) {
        return new String[0];
    }
    List<String> keys = new ArrayList<>();
    for (Issue issue : issues.value()) {
        keys.add(issue.value());
    }
    return keys.toArray(new String[keys.size()]);
}
 
示例7
public static List<Link> createLinks(final Issues issues) {
    return Arrays.stream(issues.value())
            .map(Allure1Utils::createLink)
            .collect(Collectors.toList());
}
 
示例8
@Override
public void startOfScenarioLifeCycle(Scenario scenario) {

    //to avoid duplicate steps in case of Scenario Outline
    if (SCENARIO_OUTLINE_KEYWORDS.contains(scenario.getKeyword())) {
        synchronized (gherkinSteps) {
            gherkinSteps.clear();
        }
    }

    currentStatus = PASSED;

    TestCaseStartedEvent event = new TestCaseStartedEvent(uid, scenario.getName());
    event.setTitle(scenario.getName());

    Collection<Annotation> annotations = new ArrayList<>();

    SeverityLevel level = getSeverityLevel(scenario);

    if (level != null) {
        annotations.add(getSeverityAnnotation(level));
    }

    Issues issues = getIssuesAnnotation(scenario);
    if (issues != null) {
        annotations.add(issues);
    }

    TestCaseId testCaseId = getTestCaseIdAnnotation(scenario);
    if (testCaseId != null) {
        annotations.add(testCaseId);
    }

    annotations.add(getFeaturesAnnotation(feature.getName()));
    annotations.add(getStoriesAnnotation(scenario.getName()));
    annotations.add(getDescriptionAnnotation(scenario.getDescription()));

    AnnotationManager am = new AnnotationManager(annotations);
    am.update(event);

    event.withLabels(AllureModelUtils.createTestFrameworkLabel("CucumberJVM"));

    ALLURE_LIFECYCLE.fire(event);
}
 
示例9
/**
 * @return true if {@link ru.yandex.qatools.allure.annotations.Issues}
 * annotation present in {@link #annotations} and false otherwise
 */
public boolean isIssuesAnnotationPresent() {
    return isAnnotationPresent(Issues.class);
}