我已经搜索了一段时间,但没有找到问题的答案:我可以使用相同的输入运行功能文件 x 次吗? x 应该是配置文件中的数字。
Feature: SpecFlowFeature
In order to avoid silly mistakes
As a math idiot
I want to be told the sum of two numbers on DEV environment <= Can I do this? Can DEV be a parameter?
@mytag
Scenario: Add two numbers
Given I have entered 50 into the calculator
And I have entered 70 into the calculator
When I press add
Then the result should be 120 on the screen
因此,基于上面的功能,我希望能够从配置文件中读取一个数字,这将是我想要运行相同功能的次数。换句话说我想加 50 + 70 10 次。从配置文件读取的次数。我可以使用 Specflow 做到这一点吗?
虽然我不知道如何使用配置文件来做到这一点,但我建议您创建一个场景大纲。例如,在你的情况下:
Feature: SpecFlowFeature
In order to avoid silly mistakes
As a math idiot
I want to be told the sum of two numbers on DEV environment
@mytag
Scenario Outline: Add two numbers
Given I have entered 50 into the calculator
And I have entered 70 into the calculator
When I press add
Then the result should be 120 on the screen
And this concludes testrun number '<id>'
Examples:
|id|
|1 |
|2 |
|3 |
|...
现在最后一步可能是无效的,或者您可以使用报告工具来跟踪测试运行。无论哪种方式,测试都会运行与示例表中的 ID 数量一样多的次数。
你还可以这样做:
Feature: SpecFlowFeature
In order to avoid silly mistakes
As a math idiot
I want to be told the sum of two numbers on DEV environment
@mytag
Scenario Outline: Add two numbers
Given I have entered '<value1>' into the calculator
And I have entered '<value2>' into the calculator
When I press add
Then the result should be '<expected value>' on the screen
Examples:
|value1|value2|expected value|
|50 |70 |120 |
|50 |70 |120 |
|50 |70 |120 |
|50 |70 |120 |
|50 |70 |120 |
|50 |70 |120 |
|...
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)