下面列出了org.testng.TestRunner#org.testng.internal.IResultListener 实例代码,或者点击链接到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));
}