2012-03-04 11 views
4
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 | 

上記のシナリオでは、私はしたいと思います:をSpecFlow - リストを使ってテストをX回繰り返しますか?

  • を与え - 検索DB
  • から10人のメンバーをTHEN + WHEN - 一度、各レコードのために、これらのステップを10回行います。

これはSpecFlowで可能ですか?
もしそうなら、どのように設定しますか?

TIA

答えて

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... | 

これは例のテーブル内の各IDに一度あなたのシナリオを実行します。必要に応じて、複数の列を持つように表を拡張することができます。詳細については

それとも、もっと簡単に(あなたが本当にのみ上記のあなたの例のテーブルのそれぞれに1行を持っている場合)

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... | 

specflow-wiki on githubcucumber language syntax for scenario outlines

+0

感謝を参照してください。私はついにこの小さなナゲットを見つけました、そして、それは素晴らしいです! –

+0

また、入力をより変更可能にするためにテーブルを使用しています。この一般的な形式ではおそらく100回のテストがあり、あるものは複数行の入力を受け取ります(表内)。再び - ありがとう! –

関連する問題