【问题标题】:bad tag error in feature file cucumber/eclipse功能文件黄瓜/日食中的错误标记错误
【发布时间】:2018-03-11 13:52:44
【问题描述】:

我尝试在我的功能文件中添加一个标签(使用 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 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();
        }

【问题讨论】:

    标签: java eclipse cucumber gherkin


    【解决方案1】:

    Before注解需要加'@'

    @Before("@env")
    public void setEnvironment() {
    

    【讨论】:

      【解决方案2】:

      你必须确保在你的关键字之前添加@,如果有多个,那么它应该如下 -

      tags="@Smoke-Login,@Smoke_Campaign,@Sanity-Campaign,@Smoke-Dashboard"
      

      如果有一个

      tags="@Smoke-Login"
      

      【讨论】:

        猜你喜欢
        • 2011-11-23
        • 1970-01-01
        • 1970-01-01
        • 2022-08-10
        • 1970-01-01
        • 2017-12-13
        • 2018-03-11
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多