功能文件中的错误标记错误 cucumber/eclipse
bad tag error in feature file cucumber/eclipse
我尝试在我的功能文件中添加一个标签(在 eclipse 中使用黄瓜插件)但是当我 运行 我的功能文件时它给我一个错误:
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 Whosebug website
Class 环境设置:
@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"
我尝试在我的功能文件中添加一个标签(在 eclipse 中使用黄瓜插件)但是当我 运行 我的功能文件时它给我一个错误:
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 Whosebug website
Class 环境设置:
@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"