问题
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