简体   繁体   English

javacumul.api.cli.main命令行用法

[英]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.

相关问题 Java Cucumber CLI(cucumber.api.cli.Main)的--glue选项的语法 - Syntax of --glue option for Java Cucumber cli (cucumber.api.cli.Main) Java Cucumber - 错误:无法找到或加载主类 Cucumber.api.cli.Main - Java cucumber - Error: Could not find or load main class cucumber.api.cli.Main 基本黄瓜测试项目-如何运行javacumber.api.cli.Main? - Basic Cucumber test project - how to run java cucumber.api.cli.Main? Cucumber 测试 - 找不到类 cucumber.api.cli.Main - Cucumber test - could not find classs cucumber.api.cli.Main CLI runner cucumber.api.cli.Main 找不到步骤定义 - CLI runner cucumber.api.cli.Main cannot find step definitions 错误:无法找到或加载主类cucumber.api.cli.Main - Error: Could not find or load main class cucumber.api.cli.Main 测试运行,但是:无法找到或加载主类cucumber.api.cli.Main - Test run, but: Could not find or load main class cucumber.api.cli.Main 无法在Eclipse中使用Gradle运行黄瓜功能文件。 我收到“错误:无法找到或加载主类Cucumber.api.cli.Main”错误 - Unable to run cucumber feature file using gradle in Eclipse. I am getting “Error: Could not find or load main class cucumber.api.cli.Main” error 试图实现 cucumber.api.cli.Main.main() - Trying to implement cucumber.api.cli.Main.main() 命令模式Java API用法 - Command pattern java API usage
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM