我創建一個方案概述類似於下面的一個(這是一個簡化版本,但給我的問題的一個很好的跡象):的多維場景勾勒出Specflow
Given I have a valid operator such as 'MyOperatorName'
When I provide a valid phone number for the operator
And I provide an '<amount>' that is of the following '<type>'
And I send a request
Then the following validation message will be displayed: 'The Format of Amount is not valid'
And the following Status Code will be received: 'AmountFormatIsInvalid'
Examples:
| type | description | amount |
| Negative | An amount that is negative | -1.0 |
| Zero | An amount that is equal to zero | 0 |
| ......... | .......... | .... |
的例子表提供了測試數據,我需要,但我會以複製測試不同的運營商
Examples:
| operator |
| op_numb_1 |
| op_numb_2 |
| op_numb_3 |
,以避免重複同樣的場景輪廓三次添加另一個示例表與運營商(而不是MyOperatorName)只是名稱;我知道這是不可能的,但我想知道什麼是最好的方法來避免使用三個不同的場景輪廓內的功能,除了運營商名稱相同。 我知道我可以重複使用相同的步驟定義,但我試圖瞭解是否有一個最佳做法,以防止與太相似的場景混淆功能。
公平地說,'當我爲操作員提供有效的電話號碼'在選項c中是多餘的。 - 你可以寫'當我用一個有效的電話號碼和金額「-1.0」發送請求時。 – perfectionist
好的答案,我肯定會再次@完美主義者,並推低選項d。只是選擇範例來充實你的測試,而不是詳盡地測試每種可能的組合。如果你需要詳盡的測試,然後連接一些可以產生組合測試的東西(請參閱mbUnit),或者只是一個控制檯應用程序,重新使用您的Specflow綁定... – AlSki
感謝@perfectionist,我真的很感謝你的答案;它絕對是完整和詳盡的。 –