我有一個Specflow方案類似下面我可以在Specflow中重用場景嗎?
Scenario: I Shoot a gun
When I pull the trigger
Then It should expel a bullet from the chamber
什麼,我想是重用低於
Scenario: I Shoot a gun till there are no bullets left
Given I have a fun with 2 bullets in
And I Shoot a gun
And I Shoot a gun
Then There should be no bullets left in the gun
這種情況下,如代碼在一刻起,我要重複場景中的所有步驟我拍槍像下面
Scenario: I Shoot a gun till there are no bullets left
Given I have a fun with 2 bullets in
When I pull the trigger
Then It should expel a bullet from the chamber
When I pull the trigger
Then It should expel a bullet from the chamber
Then There should be no bullets left in the gun
在這種情況下上述准許我只保存2個步驟,但在我的現實生活中的應用,我再節約在某些情況下寫大約20+步。我相信能夠調用場景使得閱讀起來更容易,而不必擔心隱藏的步驟。
這是可能的Specflow?
你的意思是重複使用步驟,例如「鑑於我有一槍有兩顆子彈」? – 2012-08-02 00:23:10
否重用整個方案有點像功能。 – pengibot 2012-08-02 08:40:01