【发布时间】:2016-01-04 18:36:40
【问题描述】:
如何使用功能传递多个参数。
我知道“示例:”概念的用法,但它在某种程度上使功能文件更加复杂和不可读
例子:
Scenario Outline: To verify that default value for some timeout when invalid/remove is set for some timeout parameter
When <parameterA> is <action> with <parameterB> for <someOtherParameterPair> in <fileName>
Then <parameterA> is updated with value <parameterB> for <someOtherParameterPair> in <fileName> as per defined <action>
Examples:
|parameterA |parameterB |action|someOtherParameterPair|fileNameWithSectionName|
|oneParameter|twoParameter|update|key:Value |abc.config:appSettings |
|oneParameter|twoParameter|delete|key:Value |def.config:appSettings |
在这里,我有大约 7 个来自测试用例的参数(由于限制,我尝试将它们包含在 5 个参数中)
我会在步骤定义文件中使用拆分将“someOtherParameterPair”和“fileNameWithSectionName”分成两部分。所以我总共有大约 7 个参数将在测试用例中使用。
但我不确定从 Given/When/Then 语句中接受如此大量的参数是否可行。这也使我的测试用例不可读。
在上述场景中,我正在尝试修改位于特定位置的 *.config 文件中的一些参数(我从功能文件传递,以便我的 When/Then 语句可以修改)。
之后我需要执行测试用例。
以同样的方式,我的测试套件中还有其他(大部分)案例。
请帮助我是 BDD 正确的方法。 BDD 是否会在维护中产生一些问题,因为我看到了很多东西(几乎所有东西都来自)功能文件。
【问题讨论】:
标签: c# automation bdd acceptance-testing gherkin