Search in sources :

Example 1 with Features

use of ru.yandex.qatools.allure.annotations.Features in project allure-cucumberjvm by allure-framework.

the class AllureRunListener method testSuiteStarted.

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);
}
Also used : AnnotationManager(ru.yandex.qatools.allure.utils.AnnotationManager) TestSuiteStartedEvent(ru.yandex.qatools.allure.events.TestSuiteStartedEvent) ArrayList(java.util.ArrayList) Features(ru.yandex.qatools.allure.annotations.Features) Stories(ru.yandex.qatools.allure.annotations.Stories) Annotation(java.lang.annotation.Annotation)

Aggregations

Annotation (java.lang.annotation.Annotation)1 ArrayList (java.util.ArrayList)1 Features (ru.yandex.qatools.allure.annotations.Features)1 Stories (ru.yandex.qatools.allure.annotations.Stories)1 TestSuiteStartedEvent (ru.yandex.qatools.allure.events.TestSuiteStartedEvent)1 AnnotationManager (ru.yandex.qatools.allure.utils.AnnotationManager)1