下面列出了怎么用org.testng.internal.IResultListener的API类实例代码及写法,或者点击链接到github查看源代码。
@BeforeSuite
@Parameters({"selenium.host", "selenium.port"})
public void attachScreenshotListener(@Optional("localhost") String host,
@Optional("4444") String port, ITestContext context) {
if (!"localhost".equals(host)) {
return;
}
Selenium screenshotTaker = new DefaultSelenium(host, Integer.parseInt(port),
"", "");
TestRunner tr = (TestRunner) context;
File outputDirectory = new File(context.getOutputDirectory());
tr.addListener((IResultListener) new ScreenshotListener(outputDirectory,
screenshotTaker));
}