如果带有注释的方法
@AfterMethod具有
ITestResult参数,则TestNG将自动注入测试结果。(来源:TestNG文档,第5.18.1节)
这应该做的工作:
@AfterMethodpublic void tearDown(ITestResult result) { if (result.getStatus() == ITestResult.FAILURE) { //your screenshooting pre goes here } }
如果带有注释的方法
@AfterMethod具有
ITestResult参数,则TestNG将自动注入测试结果。(来源:TestNG文档,第5.18.1节)
这应该做的工作:
@AfterMethodpublic void tearDown(ITestResult result) { if (result.getStatus() == ITestResult.FAILURE) { //your screenshooting pre goes here } }