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

The following examples show how to use ru.yandex.qatools.allure.annotations.Stories. 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
private List<Label> getLabels() {
    final Method method = getMethod();
    final List<Label> labels = new ArrayList<>();
    labels.addAll(Allure1Utils.getLabels(method, Severity.class, Allure1Utils::createLabels));
    labels.addAll(Allure1Utils.getLabels(method, Stories.class, Allure1Utils::createLabels));
    labels.addAll(Allure1Utils.getLabels(method, Features.class, Allure1Utils::createLabels));
    return labels;
}
 
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: AllureRunListener.java    From allure-cucumberjvm with Apache License 2.0 5 votes vote down vote up
public void testSuiteStarted(Description description, String suiteName) throws IllegalAccessException {

        String[] annotationParams = findFeatureByScenarioName(suiteName);

        //Create feature and story annotations. Remove unnecessary words from it
        Features feature = getFeaturesAnnotation(new String[]{annotationParams[0].split(":")[1].trim()});
        Stories story = getStoriesAnnotation(new String[]{annotationParams[1].split(":")[1].trim()});

        //If it`s Scenario Outline, add example string to story name
        if (description.getDisplayName().startsWith("|")
                || description.getDisplayName().endsWith("|")) {
            story = getStoriesAnnotation(new String[]{annotationParams[1].split(":")[1].trim()
                    + " " + description.getDisplayName()});
        }

        String uid = generateSuiteUid(suiteName);
        TestSuiteStartedEvent event = new TestSuiteStartedEvent(uid, story.value()[0]);

        event.setTitle(story.value()[0]);

        //Add feature and story annotations
        Collection<Annotation> annotations = new ArrayList<>();
        for (Annotation annotation : description.getAnnotations()) {
            annotations.add(annotation);
        }
        annotations.add(story);
        annotations.add(feature);
        AnnotationManager am = new AnnotationManager(annotations);
        am.update(event);

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

        getLifecycle().fire(event);
    }
 
Example #5
Source File: AllureRunListener.java    From allure-cucumberjvm with Apache License 2.0 5 votes vote down vote up
/**
 * Creates Story annotation object
 *
 * @param value story names array
 * @return Story annotation object
 */
Stories getStoriesAnnotation(final String[] value) {
    return new Stories() {

        @Override
        public String[] value() {
            return value;
        }

        @Override
        public Class<Stories> annotationType() {
            return Stories.class;
        }
    };
}
 
Example #6
Source File: AllureReporter.java    From allure-cucumberjvm with Apache License 2.0 5 votes vote down vote up
private Stories getStoriesAnnotation(final String value) {
    return new Stories() {

        @Override
        public String[] value() {
            return new String[]{value};
        }

        @Override
        public Class<Stories> annotationType() {
            return Stories.class;
        }
    };
}
 
Example #7
Source File: AnnotationManager.java    From allure1 with Apache License 2.0 5 votes vote down vote up
/**
 * Construct label for all {@link ru.yandex.qatools.allure.annotations.Stories} annotations
 * using {@link ru.yandex.qatools.allure.config.AllureModelUtils#createStoryLabel(String)}
 *
 * @return {@link java.util.List} of created labels
 */
public List<Label> getStoryLabels() {
    if (!isAnnotationPresent(Stories.class)) {
        return Collections.emptyList();
    }

    List<Label> result = new ArrayList<>();
    for (String story : getAnnotation(Stories.class).value()) {
        result.add(createStoryLabel(story));
    }
    return result;
}
 
Example #8
Source File: Allure1Utils.java    From allure-java with Apache License 2.0 4 votes vote down vote up
public static List<Label> createLabels(final Stories stories) {
    return Arrays.stream(stories.value())
            .map(value -> new Label().setName(STORY_LABEL).setValue(value))
            .collect(Collectors.toList());
}
 
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.Stories}
 * annotation present in {@link #annotations} and false otherwise
 */
public boolean isStoriesAnnotationPresent() {
    return isAnnotationPresent(Stories.class);
}