Cucumber JVM undefined step(Cucumber JVM 未定义步骤)
问题描述
我无法为项目执行一个简单的黄瓜测试.我在 Intellij 13 社区,有黄瓜插件.
I can't execute a simple test with cucumber for a project. I am on Intellij 13 Community, with cucumber plugin.
我在我的 features 目录中编写了我的功能文件,我还实现了我的步骤,在插件的帮助下创建它们.而且我在feature files中的steps被intellij识别,可以导航到step implementation.
I wrote my feature file in my features directory, I have also implemented my steps, creating them with the help of the plugin. And my steps in the feature files are recognized by intellij, which can navigate and go to the step implementation.
但是当我尝试运行我的场景时,它总是失败,因为对于每个步骤,它都会显示未定义步骤:".
But when I try to run my scenario, it always fails because for each step, it says "Undefined step : ".
这是我的项目的组织方式:
Here is how is organized my project :
正如我之前所说,您可以看到我的步骤被 Intellij 识别:
And as I said before, you can see that my steps are recognized by Intellij :
这怎么可能,我该如何纠正?
How is that possible, and how can I correct this?
任何帮助都会很棒!
现在我为跑步者添加了选项:
Now that I added options to my runner :
@CucumberOptions( monochrome = true,
features = "src/test/resources/features/",
format = { "pretty","html: cucumber-html-reports",
"json: cucumber-html-reports/cucumber.json" },
dryRun = false,
glue = "fr.tlasnier.cucumber" )
有效!
然而,我注意到在此之前,我有两个场景大纲.一个完美运行,另一个找不到步骤定义!
Yet, I noticed that before that, I had two scenario outline. One worked perfectly, the other one could not find step definition!
真的很奇怪,因为在这两种情况下都有一些步骤.
Really weird, since there were some steps in both scenario.
推荐答案
@RunWith(Cucumber.class)
@CucumberOptions( monochrome = true,
tags = "@tags",
features = "src/test/resources/features/",
format = { "pretty","html: cucumber-html-reports",
"json: cucumber-html-reports/cucumber.json" },
dryRun = false,
glue = "fr.tlasnier.cucumber" )
public class RunCucumber_Test {
//Run this
}
这篇关于Cucumber JVM 未定义步骤的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Cucumber JVM 未定义步骤


基础教程推荐
- 不推荐使用 Api 注释的描述 2022-01-01
- 大摇大摆的枚举 2022-01-01
- 如何在 Spring @Value 注解中正确指定默认值? 2022-01-01
- 验证是否调用了所有 getter 方法 2022-01-01
- 如何在 JFrame 中覆盖 windowsClosing 事件 2022-01-01
- Java 实例变量在两个语句中声明和初始化 2022-01-01
- 从 python 访问 JVM 2022-01-01
- 在 Java 中创建日期的正确方法是什么? 2022-01-01
- Java Swing计时器未清除 2022-01-01
- 多个组件的复杂布局 2022-01-01