I'm a BDD test
Feature: Register
I want to register for Authenticator
Using my name and email
Scenario: Register for Authenticator
Given I enter "Joe" "I" and "Doe" name, "joe.doe@ngc.com", "Password123$$$" and true to Terms of Use
When I press register button
Then I redirected to confirmation page
and I have unit test in xunit:
[Given(@"I enter ""(\w+)"" ""(\w+)"" and ""(\w+)"" name, ""(\w+)"", ""(\w+)"" and (.*) to Terms of Use")]
public void I_enter_registration_information(string first, string middle, string last, string email, string password, bool agree)
{
}
When I run my test, I get this error:
System.InvalidOperationException : Cannot match any method with step
Given I enter "Joe" "I" and "Doe" name, "joe.doe@ngc.com", "Password123$$$" and true to Terms of Use
. ScenarioRegister for Authenticator
I have tried different regex combination from this documentation
I'm using this library: Xunit.Gherkin.Quick
what I'm doing wrong?
From my POV, your code and plain text are both just fine.
However, it looks as if it might have turned one of your arguments into a list, rather than parsing the full string. I suspect it's something to do with the commas. (A quick check is to see if it works without the commas.)
Try using a non-greedy capture:
""(\w+?)""
I can't find any documentation suggesting that Gherkin should parse commas in that way, so it might be a bug with the library.