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 未定义步骤


- 转换 ldap 日期 2022-01-01
- 如何使 JFrame 背景和 JPanel 透明且仅显示图像 2022-01-01
- Eclipse 的最佳 XML 编辑器 2022-01-01
- GC_FOR_ALLOC 是否更“严重"?在调查内存使用情况时? 2022-01-01
- 将 Java Swing 桌面应用程序国际化的最佳实践是什么? 2022-01-01
- java.lang.IllegalStateException:Bean 名称“类别"的 BindingResult 和普通目标对象都不能用作请求属性 2022-01-01
- 获取数字的最后一位 2022-01-01
- 未找到/usr/local/lib 中的库 2022-01-01
- 在 Java 中,如何将 String 转换为 char 或将 char 转换 2022-01-01
- 如何指定 CORS 的响应标头? 2022-01-01