无法运行cucumber功能

无法运行cucumber功能,cucumber,cucumber-jvm,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

我无法运行该功能文件。每当我试图运行该文件时
我得到了下面的堆栈跟踪

    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)
线程“main”中的异常用法:java cucumber.api.cli.main[选项][ [文件|目录][:行[:行]*]]+ 选项: -g、 --从中加载粘合代码(步骤定义和挂钩)的粘合路径。 -f、 --格式化格式[:路径\或\ URL]如何格式化结果。除非指定了路径或URL,否则将转到标准输出。 内置格式类型:junit、html、pretty、progress、json。 格式也可以是完全限定的类名。 -t、 --tags TAG_EXPRESSION仅运行使用与TAG_EXPRESSION匹配的标记进行标记的场景。 -n、 --name REGEXP仅运行名称与REGEXP匹配的方案。 -d、 -->[no-]-干运行跳过胶水代码的执行。 -m、 -->[否-]-单色不为终端输出着色。 -s、 -->[no-]-严格将未定义和挂起的步骤视为错误。 --代码段名称:下划线,大小写 --DotCumber路径或URL,用于写入运行时信息。路径\或\ URL可以是文件系统 路径或URL。 -v、 --版本打印版本。 -h、 “救命啊,你正在看呢。 cucumber.runtime.CucumberException:未知选项:-插件 atcumber.runtime.RuntimeOptions.parse(RuntimeOptions.java:119) atcumber.runtime.RuntimeOptions.(RuntimeOptions.java:50) 在cucumber.runtime.RuntimeOptions.(RuntimeOptions.java:44) 位于cucumber.api.cli.Main.run(Main.java:20) 位于cucumber.api.cli.Main.Main(Main.java:16)
请帮助我解决此问题

如果您没有在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 { 
  } 

嗨,我也有这个问题,我做了以下来解决它,感谢视频中Anusha的评论 -主要的技巧是首先按照如下方式更改jar文件 cucumber-core-1.2.5.jar cucumber-java-1.2.5.jar cucumber-junit-1.2.5.jar 或以上任何一项,从1.2.4开始 -同时更新以下selenium-server-standalone-2.42.0.jar及以上版本 -同时将format关键字更改为plugin


一旦您进行了上述更改,这将解决您的问题。

可能重复的请告诉我们您是如何拨打电话的。您的命令中出现了一些错误,但我看不到,因此无法判断错误。如果不使用
--plugin
,该命令是否有效?显示有关如何调用测试的详细信息。。可能使用的命令会更有趣。我可以感觉到命令行中有一个额外的参数,'-plugin'尝试在没有这个参数的情况下执行..请不要使用单独的JAR,而是使用像Maven或Gradle这样的依赖关系管理器。这将有助于确保您具有正确的可传递依赖项。