Daily Usage Issues

XBehave support

Started by mrfox27 on 10,488 views

Hi Remco,

Do you have any plans to support XBehave.net (https://github.com/xbehave/xbehave.net)? (current version is

At present nCrunch doesn't support the "Scenario" attribute I can force the test to be recognised by using "Theory":

[Theory]
[InlineData(0, 1)]
public void PushingAnElementOntoAStack(int firstElement, int secondElement)
{
bool actual = false;

"When comparing elements"
.When(() => actual = firstElement.Equals(secondElement));

"Then comparison should fail"
.Then(() => actual.Should().BeTrue("this is deliberately incorrect to generate failure!"));
}

but it doesn't appear to execute the XBehave code in the body of any tests (the test above passes).

Any info would be much appreciated... :)
Hi, thanks for posting!

This isn't a framework I'm familiar with myself (you're the first person to ask about it), although a quick analysis suggests that the framework requires some kind of integrated interceptor to execute the assertions before completing the test.

I'm not yet sure what's involved in introducing the integration point that can make this happen. A big constraint at the moment around NCrunch's Xunit support is that it's current handled through Gallio, which does have its advantages, but also introduces certain limitations. I think that this is something that may need to be addressed in future when NCrunch's Xunit support is matured (i.e. direct integration).


Cheers,

Remco
Thanks Remco - this framework was something that I was just trying out but without nCrunch support I'm not going to switch from my current usage of NUnit. Hopefully direct integration of XUnit support won't be too far in the future, and that may re-open the door for me to try out XBehave again (by which time XBehave will also have had chance to mature). :)
I just had a play about with xBehave. It looks great. Data driven BDD tests done right. It would be great to get this working in NCrunch!

I'm guessing Gallio will need patching to support xBehave not necessarily NCrunch?
I believe so :)


Cheers,

Remco
For anyone interested, James and I did some more looking into this problem and found that NCrunch DOES actually work with XBehave.

However, you need to make sure that somewhere in your test project, you still make use of an Xunit attribute (i.e. FactAttribute or something else) in order to let Gallio's framework detector actually identify Xunit as being used by the project, otherwise none of the tests within the project will be found.

The easiest way is just to create a dummy test fixture containing an empty 'Fact' test.

For anyone watching this thread, I'd just like to add that there have been significant improvements in the execution of xBehave.net tests via NCrunch since the release of xBehave.net 2.0 (and xUnit.net 2.0), thanks to some great work by Remco.

Post a reply

Log in to reply.