@TestHomeValidation
Feature:copy function test
Background:
Given I am running test in "VARIABLE" environment
我可以VARIABLE
在上述背景给定的声明中使用吗?我想从属性文件中传递这个 VARIABLE 值。
您可以使用QAF gherkin client来实现这一点。
@TestHomeValidation
Feature:copy function test
Background:
Given I am running test in "${my.env}" environment
提供您的my.env
in 属性文件。此外,您可以拥有可以使用 QAF 配置的环境特定资源
恐怕您希望能够使用外部数据源来存储变量以提供给 Cucumber 步骤。您可能会认为我们使用DataTable
s Scenario Outline
s。在这两种情况下,您都可以提供一些本地(功能文件内)参数。例如:
Scenario: Scenario1
Given I have done "this" #this can be parsed by the glue code
Then these can be used: #You can use DataTable type to parse multiple groups of variables
| col1 | col2 | col3 |
| x | x1 | x2 |
| y | y1 | y2 |
Scenario Outline: <col1> test
Given I have done "<col2>"
Then I can see "<col3>"
| col1 | col2 | col3 |
| par1 | par2 | par3 |
就像@eugene-s 提到的那样,这不可能开箱即用。
我有一个类似的情况,我需要替换并可能从外部文件中添加更多变量。
我们寻求的解决方案是使用Gherkin 解析器解析特征,输入值并创建新树,可以将其写入新文件并传递或直接在测试运行器中替换。
有兴趣的可以关注这里的开发