用法:javacumul.api.cli.Main [选项] [[文件|目录] [:LINE [:LINE] *]] + [英] Usage: java cucumber.api.cli.Main [options] [ [FILE|DIR][:LINE[:LINE]*] ]+
问题描述
运行功能文件时出现此错误
I am getting this error while running my feature file
用法: java黄瓜[选项] [[文件|目录] [:LINE [:LINE] *]] +
选项:
-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.
Exception in thread "main" 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)
<我的跑步者课程
my runner class
package cucumber;
import org.junit.runner.RunWith;
import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;
@RunWith( value = Cucumber.class)
@CucumberOptions(dryRun = false, strict = true,
features="/STAF/src/main/java/CucumberFeature/GmailLoginLogout.feature/",
tags ={"~@/ReCall/src/SeleniumWithCucumber/FbTest.java"})
public class CucumberRunner {
}
我的功能文件
功能:Gmail登录注销
Feature: Gmail login Logout
场景:登录并注销Gmail
鉴于打开了gmail
使用有效凭证
登录后,首页应该出现
Scenario: Login and Log out to Gmail Given Open gmail When Login with valide credential Then Home page should come
我的步骤定义
package StepDfination;
import org.openqa.selenium.WebDriver;
import cucumber.api.java.en.Given;
import cucumber.api.java.en.Then;
import cucumber.api.java.en.When;
public class GmailLoginLogout {
WebDriver driver;
@Given("^Open gmail$")
public void Open_gmail(){
System.out.println("gmailopened ");
}
@When("^Login with valide credential$")
public void Login_with_valide_credential(){
System.out.println("cridential entered");
}
@Then("^Home page should come$")
public void Home_page_should_come(){
System.out.println("in home page");
}
}
推荐答案
使用CLI命令将其作为Java程序来调用
Use of CLI command to invoke it as a Java program would be
public static void main(String args[]) {
Main.main(new String[]{"-g", "StepDfination", "-t", "<your tag what you need to test", "/STAF/src/main/java/CucumberFeature/GmailLoginLogout.feature"});
}
正如蚱suggested建议的,如果您需要将其作为TestNG调用,则需要一个运行程序
As grasshopper suggested, if you need invoke it as TestNG, you need a runner class.
请注意,要素文件的位置应该是最后一个。让我知道是否有帮助!
Note that your feature file location should be the last. Let me know if it helps!
这篇关于用法:javacumul.api.cli.Main [选项] [[文件|目录] [:LINE [:LINE] *]] +的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!