Problem with "And"

Aug 15, 2013 at 4:13 PM
Edited Aug 15, 2013 at 4:14 PM

I'm starting to use NBehave. I'm trying to use a scenario that goes:
Given some state
When some actions is called
Then something happens
And something else happens

I don't seem to be able to map the "And something else happens".

My code for the last two actions is:
[Then("something happens")]
public void something_happens()

[Then("something else happens")]
public void something_else_happens()

Through resharper it says "Inconclusive: No matching Action found for "And something else..."

I'm using nbehave 0.6.2 and nbehave.resharper711 0.6.2

Am I forgetting something?
Aug 16, 2013 at 7:56 AM
The code seems fine, but the error message suggests that the step is "And something else..."
What does R# give as an suggestion on how to implement the step?
Aug 16, 2013 at 9:16 AM
Is asking me to use Given. But even when I use that, copied verbatim, still gives the same issue.
Aug 16, 2013 at 10:46 AM
Any chance you can share your feature file and the class with the steps?
Aug 16, 2013 at 11:22 AM

I was trying to get you the most basic sample that I could to illustrate the problem. And it worked correctly. I looked again to the actual code I was using, did some testing and the issue comes from having a sentence like:

And 'is it?'

with the corresponding:
[Then("And 'is it?')]
public void And_is_it()

So the interrogation inside the single quotes makes it not locate it. The fact that it was happening on my "And" was throwing me into the wrong direction.
Aug 16, 2013 at 11:34 AM
Interestingly enough, having a single ? character causes me issues soemtimes

This one -> And a fourth method happens? -> Works
This other one -> And a dialog saying No active information available. Do you want to continue anyway? is show -> Doesn't work

If I add the single quotes (as per my previous post), the first doesn't work.
This one -> And a fourth method 'happens?' -> Doesn't work
Aug 16, 2013 at 7:12 PM
The string in the Given/When/Then attribute is turned into a regular expression. It seems nbehave is not handling those chars correctly in the conversion. I will write some tests to see if I can fix that :-)