Java 功能文件/eclipse中的错误标记错误
我试图在我的功能文件中添加一个标记(使用eclipse中的cucumber插件),但当我运行我的功能文件时,它会给我一个错误:Java 功能文件/eclipse中的错误标记错误,java,eclipse,cucumber,gherkin,Java,Eclipse,Cucumber,Gherkin,我试图在我的功能文件中添加一个标记(使用eclipse中的cucumber插件),但当我运行我的功能文件时,它会给我一个错误: Exception in thread "main" gherkin.TagExpression$BadTagException: Bad tag: "env" What am I doing wrong? 我想要的是,当我运行测试时,我希望它在运行场景之前先设置环境: 功能示例: Feature: Log into an account @env Scenario
Exception in thread "main" gherkin.TagExpression$BadTagException: Bad tag: "env" What am I doing wrong?
我想要的是,当我运行测试时,我希望它在运行场景之前先设置环境:
功能示例:
Feature: Log into an account
@env
Scenario: Log Into Account With Correct Details
Given User navigates to stackoverflow website
用于环境设置的类:
@Before("env")
public void setEnvironment() {
System.setProperty("webdriver.chrome.driver", "xxx//chromedriver.exe");
this.driver = new ChromeDriver();
ActiveEnvironment = LivePortal;
EnvironmentUsed.add(ActiveEnvironment);
driver.manage().window().maximize();
}
需要为Before批注添加“@”
@Before("@env")
public void setEnvironment() {
您必须确保在关键字之前添加@,并且如果有多个关键字,则应如下所示-
tags="@Smoke-Login,@Smoke_Campaign,@Sanity-Campaign,@Smoke-Dashboard"
如果是一个
tags="@Smoke-Login"