Reputation: 2464
New to SpecFlow
If I set up my Given, When and Then scenario and do not pass arguments, everything works just fine:
Given Login to WebQA
[Given(@"Login to WebQA")]
public void LoginToWebQA()
{
All of the reading on the web indicates that all I have to do is change the attribute to include a regular expression and add the argument to the method as follows:
[Given(@"Login to '(.*)'")]
public void LoginTo(string url)
{enter code here
But when I do so, re-compile and run the test, I get the following error:
No matching step definition found for one or more steps.
[Binding] public class StepDefinitions { [Given(@"Login to WebQA")] public void GivenLoginToWebQA()
Thanks in advance
Joe
Upvotes: 3
Views: 6664
Reputation: 10209
Try without single quotes:
[Given(@"Login to (.*)")]
public void LoginTo(string url)
{enter code here
Here is random code sample I use:
Given so and so
When so and so
Then result description should be [test description]
[Binding]
public class AssertionSteps
{
[Then(@"result description should be (.*)")]
public void ThenResultDescriptionShouldBe(string hitDescription)
{
//here I also clean up the param value to remove []
}
}
Upvotes: 5