0
votes

Good morning.

I'm having a problem with SpecFlow and I can't figure out how to solve it. Would appreciate any help. So...

Lets take a simple SpecFlow feature:

Given the JoeDoe user is associated to an existing staff account with the following information
  | Field       | Value         |
  | First Name  | Joe           |
  | Last Name   | Doe           |

Which connects to the following step:

        [Given(@"the JoeDoe user is associated to an existing staff account with the following information")]
        public void GivenTheJoeDoeUserIsAssociatedToAnExistingStaffAccountWithTheFollowingInformation(Table table)
       {
        ...logic
       }

But once I change the step to accept parameters from the Feature such as the following:

        [Given(@"the (*.) user is associated to an existing staff account with the following information")]
        public void GivenTheJoeDoeUserIsAssociatedToAnExistingStaffAccountWithTheFollowingInformation(string userName, Table table)
       {
       ...logic
       }

The feature-to-step link breaks. From that point on if I press F12 ( Or go to Step Definition ) from within the featere Visual Studio tells me that there is no matching step and:

"No matching step binding found for this step! Do you want to copy the binding skeleton to clipboard ?"

And of course the test scenario doesn't run.

What's going on? I seem to be doing everything correctly.

1

1 Answers

2
votes

Have you tried:

    [Given(@"the (.*) user is associated to an existing staff account with the following information")]
    public void GivenTheJoeDoeUserIsAssociatedToAnExistingStaffAccountWithTheFollowingInformation(string userName, Table table)
   {
   ...logic
   }

It should be (.*) instead of (*.).