我有一个像下面这样的 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 多个步骤的重写。我相信能够调用 Scenario 可以更容易阅读,而不必担心隐藏的步骤。
这在 Specflow 中可能吗?