@ AfterStep / @ BeforeStep不适用于黄瓜Selenium Java

时间:2019-03-22 04:47:12

标签: selenium-webdriver cucumber

我正在黄瓜硒Java项目中苦苦挣扎@ AfterStep / @ Beforestep。

当我使用@AfterStep黄瓜钩子时,它不执行该方法(它将跳过该方法)

我尝试了很多版本,但还是没有运气。

任何人都可以帮助我解决没有兼容性问题的最新版本的POM文件

我将此文件放在stepDefinition上,并使用Cucumber.api.java.AfterStep

%%physloc%%

TestRunner:

    @AfterStep
public void tearDown(Scenario scenario) throws IOException, JiraException 
{
   System.out.println("in step method");
   if (scenario.isFailed()) {
   System.out.println("in failes screen");
   File scrFile = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
   String path=null;
   path=System.getProperty("user.dir")+"\\target\\Screenshot\\"+System.currentTimeMillis()+".png";
   FileUtils.copyFile(scrFile, new File(path));
   Reporter.addScreenCaptureFromPath(path);
   Reporter.addStepLog(scenario.getId());
  }
}

0 个答案:

没有答案
相关问题