ru.yandex.qatools.allure.annotations.Issues Java Examples

The following examples show how to use ru.yandex.qatools.allure.annotations.Issues. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Allure1Annotations.java    From allure-java with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example #2
Source File: Allure1TestCaseAspectsTest.java    From allure-java with Apache License 2.0 5 votes vote down vote up
@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";
}
 
Example #3
Source File: Allure1TestCaseAspectsTest.java    From allure-java with Apache License 2.0 5 votes vote down vote up
@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";
}
 
Example #4
Source File: AllureReporter.java    From allure-cucumberjvm with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example #5
Source File: AllureReporter.java    From allure-cucumberjvm with Apache License 2.0 5 votes vote down vote up
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;
        }
    };
}
 
Example #6
Source File: AnnotationManager.java    From allure1 with Apache License 2.0 5 votes vote down vote up
/**
 * 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()]);
}
 
Example #7
Source File: Allure1Utils.java    From allure-java with Apache License 2.0 4 votes vote down vote up
public static List<Link> createLinks(final Issues issues) {
    return Arrays.stream(issues.value())
            .map(Allure1Utils::createLink)
            .collect(Collectors.toList());
}
 
Example #8
Source File: AllureReporter.java    From allure-cucumberjvm with Apache License 2.0 4 votes vote down vote up
@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);
}
 
Example #9
Source File: AnnotationManager.java    From allure1 with Apache License 2.0 2 votes vote down vote up
/**
 * @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);
}