之前挂钩失败:Steps.beforeCenario(Scenario)Java

时间:2018-11-08 16:55:41

标签: java cucumber-junit extentreports selenium-extent-report

我正在尝试使用以下代码创建范围报告:

public static ExtentHtmlReporter htmlReporter;
public static ExtentReports extentReport;
public static ExtentTest extentTest;

@Before
public void beforeCenario(Scenario cenario) {
    if(extentReport == null) {
        extentReport = new ExtentReports();
        htmlReporter = new ExtentHtmlReporter("src/test/resources/htmlReporter.html");
        extentReport.attachReporter(htmlReporter);  

    }

    extentTest = extentReport.createTest(cenario.getId());

}

@After
public void afterCenario(Scenario cenario) {
    extentTest.log(Status.PASS, "Cenario "+ cenario.getName()+ "executado com sucesso!");
    extentReport.flush();
}

但是当我这样做时,我得到了:

  

挂钩前失败:Steps.beforeCenario(方案)

您能帮我解决吗?谢谢

0 个答案:

没有答案