我可以这样写吗

时间:2014-06-06 07:48:36

标签: bdd specflow

Scenario: Given CADD is greater than 0 and applicant confirmed as previous occupant at current   address then match strength is IO  
Given The Response contains "AC09>0"  
And   "Neaa01=0" or "NDac01=1"  
When  I fire the request  
Then  The Match strength should be "IO"  

1 个答案:

答案 0 :(得分:1)

否和否。

在解析器能够处理它时,这几乎是SpecFlow中的有效场景,除了在第二个or中使用了Given之外,您可以运行此测试({ {1}})。这确实使它成为两种不同的场景。

And

然而,作为BDD流程的一部分,这非常糟糕。你的目标应该是有一个商业语言的场景,你可以想象两个非技术人员讨论。我只是没有看到有人说" Neaa01 = 0"大声地说。

然而,你给出的场景描述实际上是一个更好的例子

Given The Response contains "AC09>0"  
And   "Neaa01=0" 
When  I fire the request  
Then  The Match strength should be "IO"  

Given The Response contains "AC09>0"  
And   "NDac01=1"  
When  I fire the request  
Then  The Match strength should be "IO"  

如果你可以改写Given CADD is greater than 0 and applicant confirmed as previous occupant at current address then match strength is IO 那么它会非常整洁。

不要忘记SpecFlow的职责是将业务语言变成可运行的东西,例如。

Given CADD is greater than 0