处理SpecFlow中的多个轻微变化

Ped*_*ias 4 .net bdd cucumber specflow gherkin

大家好我们正在开发一个可通过SOAP和REST(xml和JSon)获得的Web服务.我们的specflow功能大致相同,即:

Scenario: There are at least 3 radio Channels 
Given The test server is up and running 
And The previously obtained channel list is reset
When I request a list of radio channels
Then the resulting deliveryPackage contains a list of  at least 3 items
Run Code Online (Sandbox Code Playgroud)

所有这些功能都需要针对SOAP接口,REST/Xml接口以及REST/JSon接口进行测试.

在黄瓜中,可以使用-R运行这些功能来指示步骤文件所在的位置,但是在SpecFlow中,我还没有找到绕过步骤文件的方法,因此我可以使用相同的功能运行不同的步骤.

我宁愿不必编写每个方案3次,以便更改要使用的步骤实现.

那么,有两个问题:1)如何针对3种不同的接口运行3次特征,这些接口需要完全相同的场景?2)每次如何选择正确的步骤文件?

解决(1)可能会解决(2).

Ped*_*ias 10

我的一位同事给了我们一个很好的解决方案:情景大纲:

Scenario Outline: Channels on different protocols
Given The test server is up and running
And The previously obtained channel list is reset
When I request a list of radio channels for the <protocol> and <binding>
Then the resulting deliveryPackage contains a list of  at least 3 items
Scenarios: 
| protocol | binding                          |
| XML      | BasicHttpBinding_IProgramService |
| JSON     | BasicHttpBinding_IProgramService |
| SOAP     | CustomBinding_IProgramService    |
Run Code Online (Sandbox Code Playgroud)

在幕后,测试用例是一个接收两个参数的函数,一个用于,一个用于.

运行这个场景会产生3个单元测试,这就是我所追求的.

更多信息:管理相关方案组