Integrating external data source with Cucumber feature file

帅比萌擦擦* 提交于 2019-12-23 13:12:06

问题


I am new to Cucumber and the feature files it uses for BDD. I want to know if there is any way I could directly give the filepath of my external data file (eg. CSV file), and fetch the values of the parameters I use to create my test script.


回答1:


You can add a tag with parameter to the features

@data("/path/data.json")
  Scenario: Login as zinc admin
    Given I open zinc homepage

And then create hook that reads the param and loads file before running a scenario.

Before do |scenario|
  // read data from tag param
end


来源:https://stackoverflow.com/questions/21183659/integrating-external-data-source-with-cucumber-feature-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!