[英]Extent Report overwriting category and only shows from last test
I'm trying to create an Extent Report with several categories, this in combination with testng. 我正在尝试创建一个包含多个类别的范围报告,这与testng结合使用。 But everytime I run several classes it will overwrite the last category and in the end I will only have the last category.
但每次我运行几个类时它都会覆盖最后一个类别,最后我只会有最后一个类别。 Is there any way I can prevent this?
有什么办法可以阻止这个吗?
followin method is run in the @BeforeMethod and here I will init my test followin方法在@BeforeMethod中运行,在这里我将初始化我的测试
private void setupReportBeforeTest(Method method){
Test test = method.getAnnotation(Test.class);
String author = "ABC";
String description = "Test";
try{
description = test.description().split(",author:")[0];
if (test.description().contains(",bug:")){
author = test.description().split(",author:")[1].split(",bug:")[0];
this.setJiraBug(test.description().split(",author:")[1].split(",bug:")[1]);
}else {
author = test.description().split(",author:")[1];
this.setJiraBug(null);
}
}catch (Exception e){ }
logging = extentReports.createTest(this.getTestName() + "-" + method.getName(),description)
.assignCategory(test.groups())
.assignAuthor(author).pass("Test");
}
I'm getting the groups information from the following: 我从以下获取组信息:
@Test(groups = "Testgroup1",description = "Test1,author:Steve")
you may assign these Categories not in this setupReportBeforeTest() but in another function when tests are finished and you will have collected every groups in a table. 您可以在此setupReportBeforeTest()中分配这些类别,但在测试完成时,您可以在另一个函数中分配这些类别,并且您将收集表格中的每个组。
public void assign ( String[] testCategory)
reportTest.assignCategory(testCategory);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.