use of ru.yandex.qatools.allure.model.SeverityLevel 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.model.SeverityLevel in project allure-cucumberjvm by allure-framework.
the class AllureReporter method getSeverityLevel.
private SeverityLevel getSeverityLevel(Scenario scenario) {
SeverityLevel level = null;
List<SeverityLevel> severityLevels = Arrays.asList(SeverityLevel.BLOCKER, SeverityLevel.CRITICAL, SeverityLevel.NORMAL, SeverityLevel.MINOR, SeverityLevel.TRIVIAL);
for (Tag tag : scenario.getTags()) {
Matcher matcher = SEVERITY_PATTERN.matcher(tag.getName());
if (matcher.matches()) {
SeverityLevel levelTmp;
String levelString = matcher.group(1);
try {
levelTmp = SeverityLevel.fromValue(levelString.toLowerCase());
} catch (IllegalArgumentException e) {
LOG.warn(String.format("Unexpected Severity level [%s]. SeverityLevel.NORMAL will be used instead", levelString), e);
levelTmp = SeverityLevel.NORMAL;
}
if (level == null || severityLevels.indexOf(levelTmp) < severityLevels.indexOf(level)) {
level = levelTmp;
}
}
}
return level;
}
Aggregations