【发布时间】:2018-02-28 18:03:22
【问题描述】:
我正在尝试使用 java 和 intellij 运行一个简单的功能文件,但似乎无法正常工作。
我已经设置了我的 Cukes 测试运行器类
package config;
import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;
import org.junit.runner.RunWith;
@RunWith(Cucumber.class)
@CucumberOptions(monochrome = true,
features = {"src/test/resources/features/"},
dryRun = false,
glue = "com.ecs.googleuat"
)
public class RunCukesTest {
}
特点: 特色:家 场景:家 鉴于我在主页上
步骤定义:
import cucumber.api.PendingException;
import cucumber.api.java.en.Given;
public class MyStepdefs {
@Given("^I am on the home page$")
public void iAmOnTheHomePage() {
System.out.println("Hello");
}
}
项目结构:
我正在使用带有 java cucumber 插件的 maven 项目。
当我运行功能文件时,我收到以下错误:
未定义步骤:假设我在主页上
1 个场景(1 个未定义) 1 个步骤(1 个未定义) 0m0.000s
您可以使用下面的 sn-ps 实现缺少的步骤:
@Given("^I am on the home page$")
public void i_am_on_the_home_page() throws Throwable {
// Write code here that turns the phrase above into concrete actions
throw new PendingException();
}
进程以退出代码 0 结束
请帮助我理解我做错了什么。
谢谢
【问题讨论】:
-
胶水
com.ecs.googleuat是什么? -
你能添加一个扩展项目结构的图像,尤其是java部分吗?
-
@VinayPrajapati 这是groupID,我以为是胶水,我显然错了
-
删除 groupId 后出现什么错误?
-
这意味着黄瓜找不到你的胶水。尝试在您的 src/test/java 中创建一个目录并将其附加到您的跑步者
glue = "com.ecs.googleuat"中提供的位置
标签: java intellij-idea cucumber cucumber-jvm