use of ru.yandex.qatools.allure.utils.AnnotationManager in project allure-cucumberjvm by allure-framework.
the class AllureReporter method startOfScenarioLifeCycle.
@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);
}
use of ru.yandex.qatools.allure.utils.AnnotationManager in project allure-cucumberjvm by allure-framework.
the class AllureRunListener method testStarted.
@Override
public void testStarted(Description description) throws IllegalAccessException {
if (description.isTest()) {
String methodName = extractMethodName(description);
TestCaseStartedEvent event = new TestCaseStartedEvent(getSuiteUid(description), methodName);
event.setTitle(methodName);
Collection<Annotation> annotations = new ArrayList<>();
for (Annotation annotation : description.getAnnotations()) {
annotations.add(annotation);
}
AnnotationManager am = new AnnotationManager(annotations);
am.update(event);
getLifecycle().fire(event);
}
}
use of ru.yandex.qatools.allure.utils.AnnotationManager 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);
}
use of ru.yandex.qatools.allure.utils.AnnotationManager in project allure-cucumberjvm by allure-framework.
the class AllureRunListener method startFakeTestCase.
public void startFakeTestCase(Description description) throws IllegalAccessException {
String uid = getSuiteUid(description);
String name = description.isTest() ? description.getMethodName() : description.getClassName();
TestCaseStartedEvent event = new TestCaseStartedEvent(uid, name);
event.setTitle(name);
AnnotationManager am = new AnnotationManager(description.getAnnotations());
am.update(event);
getLifecycle().fire(event);
}
use of ru.yandex.qatools.allure.utils.AnnotationManager in project allure-cucumberjvm by allure-framework.
the class AllureReporter method feature.
@Override
public void feature(Feature feature) {
this.feature = feature;
uid = UUID.randomUUID().toString();
TestSuiteStartedEvent event = new TestSuiteStartedEvent(uid, feature.getName());
Collection<Annotation> annotations = new ArrayList<>();
annotations.add(getDescriptionAnnotation(feature.getDescription()));
annotations.add(getFeaturesAnnotation(feature.getName()));
AnnotationManager am = new AnnotationManager(annotations);
am.update(event);
ALLURE_LIFECYCLE.fire(event);
}
Aggregations