!
由於@kayle在他的回答中提到..你可以寫下面的測試場景的
Scenario Outline: Hello World
Given I am logged in as <user>
When I search for <searchTerm>
Then I add the following to my basket:
| Teapot |
| Yorkshire tea |
Examples:
| user | searchTerm |
| Adam | Tea |
或
Scenario Outline: Hello World
Given I am logged in as <user>
When I search for <searchTerm>
Then I add the following to my basket:
| <item1> |
| <item2> |
Examples:
| user | searchTerm | item1 | item2 |
| Adam | Tea | Teapot| Yorkshire tea|
如果要爲每個用戶添加不同的項目,第二個方案將是有益的。例如:
Scenario Outline: Hello World
Given I am logged in as <user>
When I search for <searchTerm>
Then I add the following to my basket:
| <item1> |
| <item2> |
Examples:
| user | searchTerm | item1 | item2 |
| Adam | Tea | Yorkshire tea | Teapot |
| Tom | Books | book1 | book2 |
希望它是明確的!
謝謝你的答案凱爾。它很清楚,但在閱讀這個答案後,我又得到了另一個問題。我已經更新了我的問題。 – npp
尖括號實際上是佔位符。你可以做到這一點,並將item1和item2視爲一種標題列,但由於您不會替換item1和item2,因此您在示例表中運行的所有場景都將使用「茶壺」和「約克夏茶」 。如果這就是你所需要的,那麼它會適合你。 –
非常感謝你:) – npp