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
}
相关文章