Specflow - 作为功能的一部分涵盖的测试类型是什么 file/BDD

Specflow - What is the testing type which is covered as part of feature file/BDD

这可能是一个愚蠢的问题,但仍在尝试找到我对 BDD Specflow 的理解。 根据我在 Specflow 上的经验 - 看到不同的公司使用 Specflow 来捕获 scenarios/test across-

例如我下面的系统集成测试覆盖率功能-

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)

在一些公司中,他们练习进一步分解组件

将上述场景分离为如下 2 个特征 -

  1. 一个验证直到插入数据库

    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
    
  2. 其他正在查看报告

    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 功能的正确方法?什么是最佳实践?

IMO,根据 BDD 指南,更好的方法是您在上面写的第二个选项。因为您在第二种情况下有点涵盖了不同的行为。任何时候场景都需要两个 when-then 语句,最好有单独的场景。查看 here ,这正是您的观点。你甚至可以检查时态,看看它们在你上面的场景中是否正确。