无法运行黄瓜功能

时间:2016-06-12 04:22:10

标签: cucumber cucumber-jvm

我无法运行功能文件。每当我试图运行文件时 我正在获得以下堆栈跟踪

    Exception in thread "main" Usage: java cucumber.api.cli.Main [options] [         
    [FILE|DIR][:LINE[:LINE]*] ]+
    Options:

-g, --glue PATH                    Where glue code (step definitions and hooks) is loaded from.
-f, --format FORMAT[:PATH_OR_URL]  How to format results. Goes to STDOUT unless PATH_OR_URL is specified.
                                   Built-in FORMAT types: junit, html, pretty, progress, json.
                                   FORMAT can also be a fully qualified class name.
-t, --tags TAG_EXPRESSION          Only run scenarios tagged with tags matching TAG_EXPRESSION.
-n, --name REGEXP                  Only run scenarios whose names match REGEXP.
-d, --[no-]-dry-run                Skip execution of glue code.
-m, --[no-]-monochrome             Don't colour terminal output.
-s, --[no-]-strict                 Treat undefined and pending steps as errors.
    --snippets                     Snippet name: underscore, camelcase
    --dotcucumber PATH_OR_URL      Where to write out runtime information. PATH_OR_URL can be a file system
                                   path or a URL.
-v, --version                      Print version.
-h, --help                         You're looking at it.

  cucumber.runtime.CucumberException: Unknown option: --plugin
at cucumber.runtime.RuntimeOptions.parse(RuntimeOptions.java:119)
at cucumber.runtime.RuntimeOptions.<init>(RuntimeOptions.java:50)
at cucumber.runtime.RuntimeOptions.<init>(RuntimeOptions.java:44)
at cucumber.api.cli.Main.run(Main.java:20)
at cucumber.api.cli.Main.main(Main.java:16)

请帮我解决问题

2 个答案:

答案 0 :(得分:1)

如果未在cukes文件中正确设置cucumberOptions,通常会出现此问题。

例如:

@RunWith(Cucumber.class) 
@CucumberOptions( dryRun = false, strict = true, features = "src/test/features/com/sample", glue = "com.sample", 
    tags = { "~@wip", "@executeThis" }, monochrome = true, 
    format = { "pretty", "html:target/cucumber", "json:target_json/cucumber.json", "junit:taget_junit/cucumber.xml" } ) 
    public class RunCukeTest { 
  } 

答案 1 :(得分:1)

您好我也有这个问题,由于Anusha对视频https://youtu.be/pD4B839qfos的评论,我做了以下事情来解决它 - 主要技巧是首先更改您拥有的jar文件,如下所示 黄瓜核心1.2.5.jar 黄瓜Java的1.2.5.jar 黄瓜的junit-1.2.5.jar  或者上述任何一种,从1.2.4起 - 还更新以下selenium-server-standalone-2.42.0.jar及更高版本 - 还将format关键字更改为插件

完成上述更改后,这可以解决您的问题。