C# Specflow-功能文件/BDD中包含的测试类型是什么
这可能是一个愚蠢的问题,但仍在试图找到我对BDDSpecFlow的理解。 根据我在Specflow中的经验-看到过不同的公司使用Specflow来捕获场景/测试-C# Specflow-功能文件/BDD中包含的测试类型是什么,c#,automated-tests,bdd,specflow,C#,Automated Tests,Bdd,Specflow,这可能是一个愚蠢的问题,但仍在试图找到我对BDDSpecFlow的理解。 根据我在Specflow中的经验-看到过不同的公司使用Specflow来捕获场景/测试- 组件级测试 功能测试 系统集成测试 回归测试 比如说我下面的系统集成测试功能- Given An active account exists When I fill up a form & submit a new investment (submitted but not approved) Then Check th
- 组件级测试
- 功能测试
- 系统集成测试
- 回归测试
Given An active account exists
When I fill up a form & submit a new investment (submitted but not approved)
Then Check the record inserted into a specific table
And new transaction displayed in Holdings report
And new transaction not displayed in cash balance report (as not yet approved)
在一些公司,他们会将其进一步分解
将上述场景分为以下两个功能-
Given An active account exists
When I fill up a form & submit a new investment (submitted but not approved)
Then Check the record inserted into a specific table
Given A new Investment is recorded
When we run the reports
Then new transaction displayed in Holdings report
And new transaction not displayed in cash balance report (as not yet approved)
上面哪一项是编写Specflow特性的正确方法?什么是最佳实践?在国际海事组织,根据BDD指南,更好的方法是您上面写的第二个选项。因为您在第二个场景中覆盖了一个不同的行为。任何时候需要两个when-then语句的场景最好有单独的场景。看看,这正是你的观点。您甚至可以检查时态,看看它们在上述场景中是否正确。谢谢@user1207289。如果我们使用上面的选项2,只是为了使我们的测试更加稳定-我们需要执行选项2的测试1作为测试2的第一步。在上面的示例中-如果存在新的投资,则在步骤中创建新的投资(填写表格或直接插入数据库),然后签入报告。第一个测试不包括在第二个测试中吗?Repative?在给定的第二个场景中,只需检查第一个测试的结束状态,即记录了投资。你不必记录投资,只需检查它是否存在。