CustomDataProvider for feature file (QAF)

不问归期 提交于 2019-12-04 04:11:31

问题


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

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