如果我在TestNG.xml
和方法中使用以下超时时间,则无法写入魅力测试结果。
<test name="TestName" time-out="60000">
<classes>
<class name="ClassName">
<methods><include name="MethodName"></include>
</methods>
</class>
</classes>
</test>
OR
@Test (timeOut = 10*60000)
例外: io.qameta.allure.AllureResultsWriteException:无法写入魅力测试结果 造成原因:java.nio.channels.ClosedByInterruptException
我使用的监听器:
public class AllureListener implements IHookable {
@Override
public void run(IHookCallBack callBack, ITestResult testResult) {
callBack.runTestMethod(testResult);
if (testResult.getThrowable() != null || testResult.getStatus() == ITestResult.FAILURE
|| testResult.getStatus() == ITestResult.SKIP
|| testResult.getStatus() == ITestResult.SUCCESS_PERCENTAGE_FAILURE
|| testResult.getStatus() == ITestResult.SUCCESS_PERCENTAGE_FAILURE) {
String methodName = testResult.getName().toString().trim();
ITestContext context = testResult.getTestContext();
WebDriver driver = (WebDriver) context.getAttribute("driver");
if (driver != null) {
AllureReportUtil ru = new AllureReportUtil();
ru.addAttachment(driver, methodName);
}
}
}
请帮助我。