BDD 如果我在给定条件下有多个变量,我如何写 table
BDD how can i write a table if I have more than one variable in Given conditions
下面是我尝试自动化的场景:
场景大纲:创建发票选择
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 |
您应该将示例与 "scenario outline" 一起使用,而不仅仅是与场景一起使用。
另外,示例 table 应该在所有 "Given When Then" 语句之后结束。
我不是 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 |
下面是我尝试自动化的场景:
场景大纲:创建发票选择
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 |
您应该将示例与 "scenario outline" 一起使用,而不仅仅是与场景一起使用。 另外,示例 table 应该在所有 "Given When Then" 语句之后结束。
我不是 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 |