2016-06-12 123 views
4

我無法運行功能文件。每當我試圖運行
我得到下面的堆棧跟蹤文件無法運行黃瓜功能

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) 

請幫我解決這個問題

+0

可能重複的[黃瓜功能文件不使用Maven執行](http://stackoverflow.com/questions/16727986/cucumber-feature-files-are-not-executed-using-maven) – deltree

+3

請告訴我們你打電話。你的命令中有些東西壞了,但我沒有看到它,所以我不知道有什麼問題。 –

+0

如果你不使用'--plugin',它可以工作嗎? – meatspace

回答

1

如果您沒有設置cucumberOptions正確您cukes文件時,您通常會得到這個問題。

例如:

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

您好我也有這個問題爲好,我做了以下解決它,這要歸功於Anusha從視頻https://youtu.be/pD4B839qfos評論 -the主要伎倆是先改變您擁有的jar文件如下: cucumber-core-1.2.5.jar cucumber-java-1.2.5.jar cucumber-junit-1.2.5.jar 或以上任何一個,從1.2.4開始向上 - 也更新以下硒服務器獨立2.42.0.jar及以上 - 也更改爲墊關鍵字插件

一旦你做出上述改變,這應該可以解決你的問題。