黄瓜JVM未定义的步骤 [英] Cucumber JVM undefined step

查看:30
本文介绍了黄瓜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 目录中编写了我的功能文件,我还实现了我的步骤,在插件的帮助下创建它们.而且我在特征文件中的步骤被intellij识别,可以导航到步骤实现.

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
}

这篇关于黄瓜JVM未定义的步骤的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆