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

The following examples show how to use ru.yandex.qatools.allure.annotations.TestCaseId. 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: AllureReporter.java    From allure-cucumberjvm with Apache License 2.0 6 votes vote down vote up
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;
}
 
Example #2
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 #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.testng.annotations.Test
public void testSomething() {
    parameterWithoutName = "testValue1";
    parameterWithName = "testValue2";
}
 
Example #4
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 #5
Source File: Allure1Utils.java    From allure-java with Apache License 2.0 4 votes vote down vote up
public static List<Link> createLinks(final TestCaseId issue) {
    return Collections.singletonList(ResultsUtils.createTmsLink(issue.value()));
}
 
Example #6
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 #7
Source File: AnnotationManager.java    From allure1 with Apache License 2.0 4 votes vote down vote up
public boolean isTestCaseIdAnnotationPresent() {
    return isAnnotationPresent(TestCaseId.class);
}
 
Example #8
Source File: AnnotationManager.java    From allure1 with Apache License 2.0 4 votes vote down vote up
private String getTestCaseId() {
    TestCaseId testCaseId = getAnnotation(TestCaseId.class);
    return testCaseId == null ? null : testCaseId.value();
}