【发布时间】:2021-03-13 17:12:54
【问题描述】:
我尝试使用以下代码将失败测试的屏幕截图发送到 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;
}
【问题讨论】:
-
您需要分享什么是 ReportPortalMessage 类,因为目前看来您刚刚将其设置为 null。
标签: java reporting reportportal