BDD如果给定条件下有多个变量,我该如何写表

时间:2018-10-25 10:54:59

标签: bdd

在我要自动执行的方案下面,

方案大纲:选择

创建发票
Given   following <payment_term> is selected
And     following <delivery_terms> is selected
And     following <verzenderijnr> is selected
        Examples:
          | payment_term | delivery_terms | verzenderijnr |
          |    1         |     1          |   1           |
          |    2         |     2          |   2           |
When   i transition the document to "final_invoice"
Then   i expect the following transaction in my administration:
Examples:
         | journal.id | account.id | document_date | due_date   |
         | VRK1       | 10016      | "2018-12-17"  | 2019-01-24 |

2 个答案:

答案 0 :(得分:1)

您应该将示例与“方案大纲”一起使用,而不仅应与方案一起使用。 同样,Example表应该在所有“ Given When Then”语句之后结束。

答案 1 :(得分:1)

我不是100%地确定您要精确完成什么,但是如果这样做,您的方案难道不会更容易阅读吗?

Scenario Outline: Determine due date for sales invoices
Given I am creating a sales invoice on <Invoice date>
When I should <Pay within days>
Then the <Due date> should be correct

Examples:
| Invoice date | Pay within days | Due date   |
| 2018-12-18   | 5               | 2018-12-23 |
| 2018-12-29   | 5               | 2019-01-02 |