对于Junit 4测试,Allure报告未显示除NORMAL以外的严重度级别

edqdpe6u  于 2022-11-11  发布在  其他
关注(0)|答案(1)|浏览(208)

我正在进行一个简单的JUnit 4测试,其中我集成了Allure来显示测试结果。
在测试级别上,我提供了以下注解以显示严重度:-
@Severity(SeverityLevel.CRITICAL)
但在Allure报告中,生成后,它仅将严重性级别的严重性显示为NORMAL:-
Severity: normal
有人知道可能的解决方案是什么吗?
我尝试在运行时使用Allure Lifecycle更新测试用例,以创建自定义标签,但它没有反映Allure UI。

AllureLifecycle lifecycle = Allure.getLifecycle();
        lifecycle.updateTestCase(UUID.randomUUID().toString(), testResult ->
                testResult.getLabels().add(new Label().setName("severity").setValue(SeverityLevel.CRITICAL.toString())));
5tmbdcev

5tmbdcev1#

对我也不起作用。不得不创建我自己的注解,用@LabelAnnotation(name = SEVERITY_LABEL_NAME)注解。

@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD})
@LabelAnnotation(name = SEVERITY_LABEL_NAME)
public @interface TestSeverity {
    SeverityLevel value();
}

相关问题