[英]java cucumber.api.cli.main command line usage
Trying to do some automated tests. 尝试进行一些自动化测试。 I am facing difficulty in executing cucumber project from command line instead of eclipse.
我面临着从命令行而不是蚀执行黄瓜项目的困难。 I know we can do it through cucumber.api.cli.main class (cucumber-core.jar) but I don't know how to use it from command line options.
我知道我们可以通过Cucumber.api.cli.main类(cucumber-core.jar)来做到这一点,但是我不知道如何从命令行选项中使用它。
Commands tried for Junit execution: 尝试执行Junit的命令:
java -cp C:/Users/path/Downloads/selenium-java-3.0.1/lib/junit-4.12.jar org.junit.runner.JUnitCore C:/Users/path/workspace/CucumberConcept/src/ cucumber.CucumberRunner
java -cp C:/Users/path/Downloads/selenium-java-3.0.1/lib/junit-4.12.jar;C:/Users/path/workspace/CucumberConcept/src/ org.junit.runner.JUnitCore cucumber.CucumberRunner
java -cp C:/Users/path/Downloads/selenium-java-3.0.1/lib/junit-4.12.jar org.junit.runner.JUnitCore CucumberConcept.src.cucumber.CucumberRunner
java -cp C:/Users/path/Downloads/selenium-java-3.0.1/lib/junit-4.12.jar org.junit.runner.JUnitCore cucumber.CucumberRunner.CucumberRunner
java -cp C:/Users/path/Downloads/selenium-java-3.0.1/lib/junit-4.12.jar org.junit.runner.JUnitCore CucumberRunner.CucumberRunner
java -cp C:/Users/path/Downloads/selenium-java-3.0.1/lib/junit-4.12.jar org.junit.runner.JUnitCore CucumberRunner CucumberRunner
java -cp C:/Users/path/Downloads/selenium-java-3.0.1/lib/junit-4.12.jar org.junit.runner.JUnitCore CucumberRunner.java CucumberRunner
java -cp C:/Users/path/Downloads/selenium-java-3.0.1/lib/junit-4.12.jar org.junit.runner.JUnitCore CucumberRunner
Jar file location: Jar文件位置:
C:/users/path/lib/cucumber-core-1.2.4.jar
Project Structure: 项目结构:
CucumberConcept
-src
-cucumber(package)
-CucumberRunner.java
-Features(package)
-Stepdefinitions.java
-myfeature.feature
CucumberRunner.java code CucumberRunner.java代码
package cucumber;
import org.junit.runner.RunWith;
import cucumber.api.junit.*;
import cucumber.api.CucumberOptions;
@RunWith(Cucumber.class)
@CucumberOptions(
plugin = {"pretty","json:target/json/output.json","html:target/html/"},
features = {"src/cucumber/"}
)
public class CucumberRunner {
}
It's not the CucumberRunner
that you need to reference in your invocation, but the location of the feature file(s) that you want Cucumber to process. 调用时不需要引用
CucumberRunner
,而需要Cucumber处理的功能文件的位置。
And to access the Cucumber CLI you have to run the Main
class, not JUnitCore 要访问Cucumber CLI,您必须运行
Main
类,而不是JUnitCore
So, from src
I would expect 所以,从
src
我希望
java -cp path;more/Path;even/More/Path cucumber.api.cli.Main .
to work... as long as the Cucumber jar(s) are on the classpath. 工作...只要黄瓜罐子在类路径上即可。 AT the very least you'll need
cucumber-core
on the classpath. 至少,您需要在类路径上使用
cucumber-core
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.