【问题标题】:Can I use cucumber hooks with parameters我可以使用带参数的黄瓜钩吗
【发布时间】:2021-03-26 22:09:41
【问题描述】:

这是我的例子:

@smoke()
  Scenario: User Login Invalid scenario
    Given User is at the login page of the application
    When User login with the following username and password with data in excel at 
     "src/test/resources/excel/user1.xlsx"

我想要做的是我想将我的路径作为钩子参数传递。这可能吗?

@smoke("src/test/resources/excel/user1.xlsx")
  Scenario: User Login Invalid scenario
    Given User is at the login page of the application
    When User login with the following username and password with data in excel at

如果没有,有没有办法导入数据和before hook?

【问题讨论】:

    标签: selenium cucumber hook gherkin


    【解决方案1】:

    不,这是不可能的。见https://www.tutorialspoint.com/cucumber/cucumber_hooks.htm。 您可以使用Before hook,或者在设置驱动程序时,您可以读取数据并将其存储在全局变量中,然后在需要的地方使用它。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-04-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多