SpecFlow可重复使用的步骤定义

有没有办法让SpecFlow重用步骤定义?

在其他工具中,我使用了包含诸如的方法的GivenWhenThen基类

WhenAnOrderIsCreated – 这将通过inheritance类来使用受保护的订单成员。

似乎无法使用SpecFlow(似乎不喜欢inheritance)

有没有办法分享各个function的步骤?

非常感谢

为什么是可能的 – 查看步骤function的调用步骤( https://github.com/techtalk/SpecFlow/blob/master/Tests/TechTalk.SpecFlow.Specs/Features/CallingStepsFromStepDefinition.feature

简而言之,您创建一个inheritance自以下步骤的步骤定义类:

[Binding] public class CallingStepsFromStepDefinitionSteps : Steps {} 

然后你可以简单地调用这样的其他步骤:

 [Given(@"I am logged in")] public void GivenIAmLoggedIn() { Given("I am on the index page"); When("I enter my unsername nad password"); And("I click the login button"); incStepCount(); } 

我希望我能正确理解你的问题,这是对它的回答