偶然地,我的范围报告视图开始变得非常混乱,我不明白为什么。将在此处添加屏幕截图和一些代码
<dependency>
<groupId>com.aventstack</groupId>
<artifactId>extentreports</artifactId>
<version>3.0.2</version>
</dependency>
@BeforeClass
public synchronized void beforeClass(ITestContext ctx) {
suiteName = ctx.getCurrentXmlTest().getSuite().getName();
ExtentTest parent = ExtentManager.getInstance(suiteName).createTest(getClass().getName());
parentTest.set(parent);
}
@BeforeMethod
public void setup(Method method) throws IOException {
//Extent report config
ExtentTest child = parentTest.get().createNode(method.getName());
test.set(child);
Reporter.log("Method -" + method.getName() + " - is started.");
Reporter.log("---------------------------------------------------------------------------------------------");
}
@AfterMethod(alwaysRun = true)
public void closeWindow(ITestResult result) {
if (result.getStatus() == ITestResult.FAILURE) {
test.get().fail(result.getThrowable());
Reporter.logFail("Test FAILED");
} else if (result.getStatus() == ITestResult.SKIP)
test.get().skip(result.getThrowable());
else
test.get().pass("Test passed");
ExtentManager.getInstance(suiteName).flush();
Reporter.log("Stopping tests");
}
添加截图以显示结果enter image description here