SpecFlow - 用列表重复测试X次?

Kei*_*ows 4 specflow

Scenario: Change a member to ABC 60 days before anniversary date
    Given Repeat When+Then for each of the following IDs:
    | ID         |
    | 0047619101 |
    | 0080762602 |
    | 0186741901 |
    | 0311285102 |
    | 0570130101 |
    | 0725968201 |
    | 0780265749 |
    | 0780265750 |
    | 0780951340 |
    | 0780962551 |
#-----------------------------------------------------------------------
    When these events occur:
    | WorkflowEventType   | WorkflowEntryPoint |
    | ABC                 | Status Change      | 
    Then these commands are executed:
    | command name      |
    | TerminateWorkflow |
    And For Member, the following documents were queued:
    | Name       |
    | ABC Packet |
Run Code Online (Sandbox Code Playgroud)

在上面的场景中,我想:

  • GIVEN - 从DB中查找10个成员
  • 当时+那么 - 这些步骤10次,每次记录一次.

SpecFlow可以实现吗?
如果是这样,你会如何设置它?

TIA

per*_*ist 6

这实际上很容易做到,虽然文档需要一些搜索.

您想要的是场景大纲,如下所示:

Scenario Outline: Change a member to ABC 60 days before anniversary date
Given I have <memberId>
When these events occur:
    | WorkflowEventType   | WorkflowEntryPoint |
    | ABC                 | Status Change      | 
Then these commands are executed:
    | command name      |
    | TerminateWorkflow |
And For <memberId>, the following documents were queued:
    | Name       |
    | ABC Packet |

Examples: 
    | memberId   |
    | 0047619101 |
    | 0080762602 |
    | 0186741901 |
    | ...etc...  |
Run Code Online (Sandbox Code Playgroud)

这将为示例表中的每个id执行一次您的方案.如果需要,您可以将表扩展为具有多个列.

或者,更简单(如果您在上面的每个示例表中只有一行)

Scenario Outline: Change a member to ABC 60 days before anniversary date
Given I have <memberId>
When A 'ABC' Event Occurs with EntryPoint 'Status Change'
Then a TerminateWorkflow command is executed
And For <memberId>, the 'ABC Packet' document was queued

Examples: 
    | memberId   |
    | ...etc...  |
Run Code Online (Sandbox Code Playgroud)

有关更多信息,请参阅github上specflow-wiki场景轮廓黄瓜语言语法