【问题标题】:Is it possible to generate java test stub files from cucumber gherkin feature file?是否可以从黄瓜小黄瓜功能文件生成 java 测试存根文件?
【发布时间】:2014-02-16 16:48:36
【问题描述】:

不是读取特性文件,而是编写方法的名称,添加正确的注释和变量我想“编译”特性文件并自动生成 java 测试文件。

有可能吗?你知道可以做到这一点的工具吗?

【问题讨论】:

    标签: java cucumber bdd gherkin cucumber-jvm


    【解决方案1】:

    如果您运行 Cucumber-JVM,它将为每个未定义的步骤生成 sn-ps。您可以将它们剪切并粘贴到您选择的类中。

    在 IntelliJ 中运行,您可以使用 Alt-Return 生成步骤的定义。 Eclipse 的插件也可以做到这一点,但我最近没有使用它们。

    【讨论】:

    • 谢谢!它在 IntelliJ 社区版中不起作用 :( 但我可以运行测试并查看未定义的步骤。它只显示最后一步,有没有办法查看所有缺少的步骤?
    • 抱歉 - 有事。但是你可以从命令提示符(应该打印出所有的 sn-ps)尝试这个: mvn clean test
    【解决方案2】:

    您可以设置dryRun=true,它应该会显示所有缺少的步骤。

    @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 = true,
                             glue = "glue_code_folder" )
    
    public class RunCucumber_Test {
      //Run this
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-10-17
      • 2016-04-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多