无法在黄瓜覆盖率报告中生成屏幕截图

时间:2019-08-29 05:00:55

标签: selenium-webdriver cucumber extentreports

我看不到黄瓜范围报告捕获的屏幕截图。

我已经调试并观察到代码已执行,但是屏幕截图未保存在扩展报告或黄瓜html报告文件中。

屏幕截图代码

public void screenshot(Scenario scenario) { 

if(scenario.isFailed()){ byte [] screenshot = SeleniumUtils.captureScreenshot(); profile.public void屏幕截图(场景方案){embed(screenshot,“ image1 / png”); }

跑步者班

@RunWith(Cucumber.class)
@CucumberOptions(
features = "src/test/java/features", tags = "@login_internal_user", glue 
 = {
    "stepDefinitions"
}, plugin = {
    "pretty",
    "rerun:src/test/java/features/rerun.txt",

 "com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter:",
    "html:reports"
}
)

公共类loginRunner {

@AfterClass
public static void teardown() {
    SeleniumUtils.quitDriver();
}
}

Extent.properties文件

# indicate which reporters to use

 extent.reporter.logger.start=true
 # point to any configuration used
 extent.reporter.logger.config=src/main/resources/extent-config.xml

  # specify output path
  extent.reporter.logger.out=reports/importsTeam-reports
  screenshot.dir=reports/importsTeam-reports/screenshots/

Maven属性 扩展黄瓜适配器版本-1.0.7 黄瓜罐-4.2.0

1 个答案:

答案 0 :(得分:0)

您应该使用html记者。您的媒体资源文件应包含

extent.reporter.html.start = true
extent.reporter.html.config = <html config xml>
extent.reporter.html.out = <output path>