gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-02 22:12:46 27 4
gpt4 key购买 nike

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 |

在上述场景中我想:

  • GIVEN - 从数据库中查找 10 个成员
  • WHEN + THEN - 执行这些步骤 10 次,每条记录一次。

SpecFlow 可以做到这一点吗?
如果是这样,您将如何设置?

TIA

最佳答案

这实际上很容易做到,尽管文档需要一些搜索。

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

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 执行一次场景。如果需要,您可以将表格扩展为具有多个列。

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

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

关于SpecFlow - 使用列表重复测试 X 次?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9559324/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com