1

When using Spec Flow and running a feature file that has implemented code behind it, I am seeing this:

Techtalk.Specrun.PendingTestException: No matching step definition found for one or more steps

I have code behind each of the features and regardless of what I try I keep getting a pending output.

e.g.

Given I browse to Url "http;//www.google.co.uk"
-> No matching step found for the step definition
[Given(@"I browse to Url""(.*)""")]
Public void GivenIBrowseToUrl(String p0)
{
  ScenarioContext.Current.Pending();
}

However the code I have implemented for this feature is as follows:

using System;
using System.Diagnostics;
using TechTalk.SpecFlow;

namespace UserJourney
{
[Binding]
  public class PhoneJourneySteps
  {
    [Given(@"I browser to Url ""(.*)""")]
    public void GivenIBrowserToUrl(string url)
    {
        Process.Start(url);
    }
  }
}
Kjuly
  • 34,476
  • 22
  • 104
  • 118

1 Answers1

0

your problem is, as the error message tells you, that you do not have a step with the correct binding.

your step has the binding:

[Given(@"I browser to Url ""(.*)""")]

it is asking for the binding:

[Given(@"I browse to Url""(.*)""")]

notice the missing space after Url?

remove the space from your binding definition and everything should work ok.

Also I would recommend using single quotes in your steps in the scenario files, it makes the bindings easier to read. So have Given I browse to the Url'http://google.com/'

Sam Holder
  • 32,535
  • 13
  • 101
  • 181