I want to have the following test step class structure:
[Binding] public class BaseStep { [Given(@"there is a customer")] public void GivenThereIsACustomer(Table table) { HandleCustomer(table); } protected virtual void HandleCustomer(Table table) { } } [Binding] public class FeatureOneStep : BaseStep { protected override void HandleCustomer(Table table) {
“Given that there is a client” is a general step that is used both in FeatureOne and FeatureTwo, but it will have different processing logic inside two functions. Therefore, I decided to include the definition of this step in the base class and override the protected methods in the two derived classes, respectively.
However, when I ran the tests, I had the following error:
TechTalk.SpecFlow.BindingException: Ambiguous step definitions found for step 'Given there is a customer': CustomerTestBase.GivenThereIsACustomer(Table), CustomerTestBase.GivenThereIsACustomer(Table)
Can someone tell me how to fix this problem?
inheritance c # ambiguous specflow acceptance-testing
wd113
source share