use of ru.yandex.qatools.allure.events.TestSuiteStartedEvent 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);
}
Aggregations