[英]Where I can found org.testng.TestNg package in testng framework using Eclipse IDE for Java?
[英]how can i send failed tests screenshots to reportportal. I am using Java + TestNG framework
我尝试使用下面的代码将失败测试的屏幕截图发送到 reportPortal,但它对我不起作用。有人可以在这里帮忙吗
public ReportPortalMessage failedScrenshot(String methodName)
{
ReportPortalMessage message = null;
String time = pg.subGrpUnique_monthdate();
File srcfile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
java.util.Date d= new java.util.Date();
try
{
org.apache.commons.io.FileUtils.copyFile(srcfile, new File("./ScreenShots/"+d.toString().replace(":", "_")+".png")); message = new ReportPortalMessage(srcfile, rp_message);
LOGGER.info("Screenshot taken.");
}
catch (IOException e)
{
e.printStackTrace();
LOGGER.info("Unable to take screenshot.");
}
LOGGER.info(message);
return message;
}
有些示例完全符合您的要求:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.