0

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.

Neysor
  • 3,893
  • 11
  • 34
  • 66
InspiredBy
  • 4,271
  • 6
  • 40
  • 67

1 Answers1

2

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 (*.).

Justin Ko
  • 46,526
  • 5
  • 91
  • 101
  • Thank you for your reply. Sorry, it's just a typo here as I was providing the example. In my code the regex value is correct. I'll modify the OP. – InspiredBy Apr 04 '12 at 19:14
  • Actually I'll reverse it ack to *. here in OP...Who knows, could be useful to someone some day. But yeah, in my case it's not the problem. – InspiredBy Apr 04 '12 at 19:16
  • Though not the issue in my case either but this could be another solution for some one else: http://groups.google.com/group/specflow/browse_thread/thread/f66f679d34edfeb2 – InspiredBy Apr 04 '12 at 19:18