我正在使用 Cucumber 编写 Rails 测试套件。
我目前有一个非常像这样的场景。
Scenario Outline:
Given I am logged in as "<user>"
When I create a <fruit>
Then I should see the <fruit> info
When I click the <fruit> delete button
Then I should see the confirmation "Fruit deleted"
Examples:
| user | fruit |
| super | apple |
| super | banana |
| ninja | apple |
| ninja | banana |
| juicer | apple |
| juicer | orange |
| cake | apple |
| cake | banana |
| cake | orange |
这工作正常,但它似乎不是很干燥。我更喜欢这样的东西。
Scenario Outline:
Given I am logged in as "<user>"
When I create a <fruit>
Then I should see the <fruit> info
When I click the <fruit> delete button
Then I should see the confirmation "Fruit deleted"
Examples:
| user | fruits |
| super | apple, banana |
| ninja | apple, banana |
| juicer | apple, orange |
| cake | apple, banana, orange |
这种事情可能吗?我的测试是否朝着正确的方向前进?