Cucumber - 无法使用 运行ner 进行 运行 测试
Cucumber - Unable to run tests using runner
问题:
当尝试 运行 黄瓜 运行ner class 以测试具体测试(通过标签)时,测试不会 运行。将收到以下消息:
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
运行 功能文件可以正常工作。您可以在下面找到 运行ner.
@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 { }
挂钩 class:
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();
}
}
}
如果我可以提供更多信息,请告诉我,因为这个问题真的很烦人,我找不到任何可以帮助的东西。
您定义 glue
有误。您应该使用包名称而不是 steps.java
.
的路径
所以改变
glue = "src/INGPSD2/test/java/Steps"
到 glue = "package_name"
您的 class with steps 所在的位置。
问题: 当尝试 运行 黄瓜 运行ner class 以测试具体测试(通过标签)时,测试不会 运行。将收到以下消息:
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
运行 功能文件可以正常工作。您可以在下面找到 运行ner.
@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 { }
挂钩 class:
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();
}
}
}
如果我可以提供更多信息,请告诉我,因为这个问题真的很烦人,我找不到任何可以帮助的东西。
您定义 glue
有误。您应该使用包名称而不是 steps.java
.
的路径
所以改变
glue = "src/INGPSD2/test/java/Steps"
到 glue = "package_name"
您的 class with steps 所在的位置。