[1.x only] Can't access fixture data when using IUseFixture #87
Comments
Hi JC. When I think about the life cycle of the objects and the emission of the test commands, whilst not obvious, the behaviour you're observing makes sense. I guess this demonstrates an incompatibility between xUnit.net's IUseFixture (not something I use) and xBehave.net. This may be solvable, but in the meantime I suggest you investigate using xBehave.net's Background attribute together with .Teardown() instead. See http://adamral.ph/2012/07/28/new-background-attribute-in-xbehave-net-0-12-0/. I'm travelling right now, but I can investigate the IUseFixture compatibility when I'm home in a few weeks, if it turns out to add value over and above Background attribute. |
Adam, Thanks for you input and I hope your trip is going well. James |
Ah it's great to hear that. Is it OK to close the issue in that case? |
It's fine to close the issue but do you think this should be documented anywhere? James |
OK, after re-reading your workaround I now see exactly what's happening. xBehave maintains it's own instances of test classes for test method invocation and these are separate from the ones that xUnit creates and invokes SetFixture() on. This means there definitely is a disconnect between the workings of xUnit and xBehave. I can see why your workaround works, but it's quite ugly to have to do that, i.e. an instance member modifying static state. I think it's better we leave this issue open and investigate a solution which removes the need to have static state. In the meantime feel free to edit the wiki - I'm not attached to its voluminous layout in any way 😉. |
Moved to Ready. The bug is clearly understood and should be addressed. |
@JCBrown I finally documented the workaround after @domgreen raised the same problem over in #18. See https://github.com/xbehave/xbehave.net/wiki/Known-Issues. Of course, I really should just fix the bug 😬. |
Thanks @adamralph, I really should have made my mark on that empty Wiki ;-) it's really come on now, just having a little read. |
Glad you like the wiki, it's surprising what can be done on one rainy Sunday 😉. It's great that you're finding xBehave so useful, hearing that makes it worthwhile. |
xbehave 2.0 is currently in RC (https://www.nuget.org/packages/Xbehave/2.0.0-rc002-build543). This will remain as a bug in 1.x, unless someone can sell me a very compelling reason why they need to stick to 1.x and why they need this to be fixed 😉. |
I'm new to BDD and xBehave but I'm already a convert!
I'm currently trying to write an integration test to test my code against a closed-source host application, I'm using a fixture which starts everything up and then shuts down gracefully when disposed, the fixture works fine for Facts and Theories but when I try to write a Scenario it seems to be started and stopped several times but is never actually available when a Scenario runs.
The following Fact HostExistsForFacts passes but the Scenario HostExistsForScenario fails.
I'm using the xUnitContrib 1.2 runner for ReSharper 7.1 with VS2012 U2.
The text was updated successfully, but these errors were encountered: