问题
I'm using QAF and it's amazing tool, but i have one problem. Are there any ways to parameterize cucumber feature steps with custom data provider as it's done in BDD files?
For example, we can insert data from external file
Examples: {'datafile':'resources/testdata.txt'}
In .BDD it's done like this:
SCENARIO: Data provider with testng method argument and context
META-DATA: {"dataProvider":"dp-with-testngmethod-contex", "dataProviderClass":"com.qmetry.qaf.automation.impl.CustomDataProvider"}
# Comment '${value}'
END
回答1:
If you found in-built data-providers does not satisfy your need then you can provide custom data provider. In case of gherkin you can provide it with Examples
:
Examples: {"dataProvider":"dp-with-testngmethod-contex", "dataProviderClass":"com.qmetry.qaf.automation.impl.CustomDataProvider"}
Any of the meta-data for data-provider can be used with Examples
.
Moreover with latest BDD2 syntax you can also provide it as below:
@dataProvider:dp-with-testngmethod-contex
@dataProviderClass:com.qmetry.qaf.automation.impl.CustomDataProvider
@regression
Scenario: my scenario
...
来源:https://stackoverflow.com/questions/54183430/customdataprovider-for-feature-file-qaf