[英]Is it possible to pass parameter value in Cucumber feature from JSON file?
We have current framework in Jbehave where we have large number of test data stored in JSON file and using Parameterconverter to pass value to JBehave stories based on specific environment. 我们在Jbehave中拥有当前框架,在该框架中,我们将大量测试数据存储在JSON文件中,并使用Parameterconverter根据特定环境将值传递给JBehave故事。 I am working on switching framework to Cucumber and wondering if I can use same JSON files or not 我正在将框架切换到Cucumber,想知道是否可以使用相同的JSON文件
Cucumber dosen't support data out side the feature file or from external file . 黄瓜不支持功能文件外部或外部文件中的数据。 What you are looking for is supported with qaf by use of json data provider . qaf通过使用json数据提供程序支持您正在寻找的内容。 With QAF your scenario can look like below: 使用QAF,您的情况如下所示:
@dataFile:resources/${env}/data/logintestdata.json
Scenario: example
Given use is on login page
When login using '${username}' and '${password}'
And store into 'status'
Then verify that '${status}' is '${isvalid}'
And verify error message '${expected_msg}'
In above example, value of ${env}
in data file path can be provided at the time of execution in different ways .This is just as an example. 在上面的示例中,可以在执行时以不同的方式提供数据文件路径中的${env}
值。这只是一个示例。 There can be other alternative ways by using different features of qaf depending on need. 通过根据需要使用qaf的不同功能,可以有其他替代方法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.