操作系统:Windows 10浏览器:Chrome浏览器版本:73.0.3683.86版(官方内部版本)(32位)
我正在运行硒黄瓜BDD项目,在此我要验证一页的标题。我正在使用扩展报告版本4。项目在本地成功运行。但是当我通过Jenkins运行它时,它在捕获屏幕截图并显示以下错误时失败。
如果我从pom.xml中删除surfire插件,则TEST无法通过Jenkins运行。
在詹金斯的执行Windows批处理命令选项中,我给出了以下命令
C:\Program Files (x86)\Jenkins\workspace\CucumberBDDFramework
mvn test
TestRunner
package com.accenture.TestRunner;
import org.testng.annotations.AfterClass;
import org.testng.annotations.Test;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import cucumber.api.CucumberOptions;
import cucumber.api.testng.AbstractTestNGCucumberTests;
import cucumber.api.testng.CucumberFeatureWrapper;
import cucumber.api.testng.TestNGCucumberRunner;
/**
* @author ajinkya.pande
*
*/
@CucumberOptions(
features="./features/WhatIsBitcoin.feature",
glue= {"com.accenture.StepDef"},
tags= {"@ExtentReport"},
dryRun = false
)
public class TestRunner {
// Write following steps or Try to extend AbstractTestNGCucumberTests
private TestNGCucumberRunner testNGCucumberRunner;
@BeforeClass(alwaysRun = true)
public void setUpClass() throws Exception{
testNGCucumberRunner = new TestNGCucumberRunner(this.getClass());
}
@Test(dataProvider = "features")
public void feature(CucumberFeatureWrapper cucumberFeature) {
testNGCucumberRunner.runCucumber(cucumberFeature.getCucumberFeature());
}
@DataProvider
public Object [][] features(){
return testNGCucumberRunner.provideFeatures();
}
@AfterClass(alwaysRun = true)
public void tearDownClass() throws Exception{
testNGCucumberRunner.finish();
}
}
步骤定义