问题: 当尝试运行黄瓜转轮类以测试特定测试(通过标签)时,测试将不会运行。将收到以下消息:
Feature: Homepage
Test ignored.
Test ignored.
@Testone
Scenario: whateves # Homepage_TC.feature:4
Given printsomething
1 Scenarios (1 undefined)
1 Steps (1 undefined)
0m0.000s
You can implement missing steps with the snippets below:
@Given("^printsomething$")
public void printsomething() throws Throwable {
// Write code here that turns the phrase above into concrete actions
throw new PendingException();
}
Process finished with exit code 0
运行功能文件可以正常运行。下面你可以找到跑步者。
@CucumberOptions(features = "src/INGPSD2/main/resources/",
format = {"pretty", "html:target/cucumber",},
glue = "src/INGPSD2/test/java/Steps",
tags = {"@Testone"})
@RunWith(Cucumber.class)
public class runnerCucumber { }
钩子类:
public class Hooks {
private static List<DriverFactory> webDriverThreadPool = Collections.synchronizedList(new ArrayList<DriverFactory>());
private static ThreadLocal<DriverFactory> driverFactory;
public SoftAssert softAssert = new SoftAssert();
@Before
public static void instantiateDriverObject() {
driverFactory = new ThreadLocal<DriverFactory>() {
@Override
protected DriverFactory initialValue() {
DriverFactory driverFactory = new DriverFactory();
webDriverThreadPool.add(driverFactory);
return driverFactory;
}
};
}
public static WebDriver getDriver() throws Exception {
return driverFactory.get().getDriver();
}
// ----------------- SETUP
// -----------------------
@After
public static void closeDriverObjects() throws Exception {
getDriver().manage().deleteAllCookies();
for (DriverFactory driverFactory : webDriverThreadPool) {
driverFactory.quitDriver();
}
}
}
如果我能提供更多信息,请告诉我,因为这个问题非常烦人,我找不到任何有用的信息。
答案 0 :(得分:2)
您定义glue
时出错。您应该使用包名称而不是steps.java
的路径
所以改变
glue = "src/INGPSD2/test/java/Steps"
到glue = "package_name"
您的课程所在的位置。