我在 godog 中定义了一个场景:
User starts a workspace with stack
Given Minishift has state "Running"
When user triggers workspace creation for stack
Then workspace should be starting
When user looks at the workspace status
Then the workspace status should be running and creation successful
我想知道是否可以将此场景重用于多个堆栈?理想情况下,我会为每个堆栈重用这个场景,如果那个堆栈失败,那么我会失败那个场景,但不是所有测试。每个堆栈都独立于其他堆栈。我不确定这是否可行,或者我是否必须手动将每个堆栈定义为一个场景并以这种方式进行。
最佳答案
Scenario Outline
with Examples
(记录为 here for behat,但也在 Godog 中实现)做你描述的:
Scenario Outline: User starts a workspace with stack
Given "<stack>" has state "Running"
When user triggers workspace creation for stack
Then workspace should be starting
When user looks at the workspace status
Then the workspace status should be running and creation successful
Examples:
| stack |
| Minishift |
| Redshift |
| Lateshift |
您的场景将被调用三次,参数为 [Minishift
, Running
]; [Redshift
, Running
] 最后 [Lateshift
, Running
] 被传递到第一步。
关于go - 是否可以重用 godog 场景?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47718814/