'Go To Definition' Not Finding Bound Step

615 views
Skip to first unread message

Jason Evans

unread,
Mar 29, 2011, 11:38:04 AM3/29/11
to SpecFlow
Hi there.

Using version 1.3.5.33 of the VS 2010 features MSI. I spotted
something that I'm unsure how easy it would be to resolve.

When I right-click on the following line in a feature file:

Then the webpage will contain the text "Daily Community Spotlight"

and choose 'Go To 'Definition' I get a message saying:

'No matching binding found for this step'

Here is the step:

[Then(@"the webpage will contain the text ""(.*)""")]
public void ThenTheWebpageWillContaingTheText(string text)
{
Assert.IsTrue(ActiveBrowser.ContainsText(text), "Webpage did not
contain expected text.");
}

I think that because the method name is generic (in other words, we're
using (.*) to capture the text), it seems that SpecFlow is unable to
match the feature file 'Then' to it's step binding.

Cheers.
Jas.

Gáspár Nagy

unread,
Mar 30, 2011, 3:56:24 AM3/30/11
to SpecFlow
No. Theoretically this should work. I'll check.

Gáspár Nagy

unread,
Mar 30, 2011, 8:07:59 AM3/30/11
to SpecFlow
I did a quick test and it worked for me, so my questions are:

- Is it possible that you had some [StepScope] on the class?
- Was the project in a compilable state?
- Do you have the [Binding] attribute on the same file as the step
binding?
- Could you make a small repro project?

Jason Evans

unread,
Mar 30, 2011, 9:43:47 AM3/30/11
to SpecFlow
Hi there.

Ahhh, yes, your right.

I have my steps split into 3 separate files:

- StepsGiven.cs
- StepsWhen.cs
- StepsThen.cs

I use one partial class defined across those three files, but only
StepsGiven has the [Binding] attribute.

StepsGiven.cs:
[Binding]
public partial class Steps : BaseTest { //

StepsThen.cs:
public partial class Steps { //

So I guess my splitting of the class is causing a problem with the 'Go
To Definition'. It works fine for steps found in the StepsGiven.cs
file, but not if the steps are stored in either of the other two
files.

Cheers.
Jas.

Gáspár Nagy

unread,
Mar 30, 2011, 1:43:50 PM3/30/11
to SpecFlow
the strange thing is, that when I did this simplification, I was sure
that nobody uses partial classes as bindings. assumptions are always
dangerous... :)

not in 1.6, but I'll fix it. could you register an issue for this
please?

Jason Evans

unread,
Mar 30, 2011, 3:48:48 PM3/30/11
to SpecFlow
Hi there.

I've created an issue for this (ID: 53) on GitHub for you.

Cheers.
Jas.
Reply all
Reply to author
Forward
0 new messages