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

The following examples show how to use ru.yandex.qatools.allure.annotations.Features. 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 Feature annotation object
 *
 * @param value feature names array
 * @return Feature annotation object
 */
Features getFeaturesAnnotation(final String[] value) {
    return new Features() {

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

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

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

        @Override
        public Class<Features> annotationType() {
            return Features.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.Features} annotations
 * using {@link ru.yandex.qatools.allure.config.AllureModelUtils#createFeatureLabel(String)}
 *
 * @return {@link java.util.List} of created labels
 */
public List<Label> getFeatureLabels() {
    if (!isAnnotationPresent(Features.class)) {
        return Collections.emptyList();
    }

    List<Label> result = new ArrayList<>();
    for (String feature : getAnnotation(Features.class).value()) {
        result.add(createFeatureLabel(feature));
    }
    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 Features features) {
    return Arrays.stream(features.value())
            .map(value -> new Label().setName(FEATURE_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.Features}
 * annotation present in {@link #annotations} and false otherwise
 */
public boolean isFeaturesAnnotationPresent() {
    return isAnnotationPresent(Features.class);
}