Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Is it possible to force NCrunch to create a new instance of NUnit test class for each test method?
yanglee
#1 Posted : Friday, August 9, 2013 11:29:31 AM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 6/25/2012(UTC)
Posts: 89
Location: China

Thanks: 23 times
Was thanked: 19 time(s) in 18 post(s)
I'm thinking if I should switch from NUnit to XUnit. The only reason I want to make the switch is NUnit reuses the same test fixture class for all test methods, while XUnit creates a new instance for each test. The previous admin of NUnit said:

Quote:
...It is much better to fully isolate each test method from the other. This requires that a new object be created for each test method... Since it would be difficult to change the way that NUnit works now, too many people would complain...


But the last time I test it (about 6 months ago), NCrunch didn't recognize some XUnit test methods. And I remember some tools didn't work with XUnit (can't remember the names but NUnit has better comparability for sure).

I think if NCrunch could force NUnit to create a new instance of class for each test, then I don't need to switch. Is it possible? If not, is it a good idea to implement this feature?

Regards,
Yang
Remco
#2 Posted : Friday, August 9, 2013 12:25:35 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,161

Thanks: 964 times
Was thanked: 1296 time(s) in 1202 post(s)
Hi Yang -

The NCrunch implementation needs to follow the standard approach as closely as possible, so I'm afraid that overriding NUnit behaviour in this instance is probably not the best long term approach for the product. NCrunch itself actually doesn't execute the NUnit tests itself - it integrates with NUnit and instructs the framework to execute tests on its behalf. This is a very different approach to, say, the NCrunch MSTest runner, which is actually a fully custom built test runner designed to behave as similarly to the normal MSTest runner as possible.

The advantage of relying on the NUnit framework itself to execute the tests is that if Charlie were to implement the behaviour you've described inside NUnit itself (i.e. perhaps as an optional feature), then NCrunch should automatically inherit the behaviour and be able to execute tests in the same way.

NCrunch's Xunit support has come a very long way since its early days. Although the test runner still relies on Gallio for the Xunit integration, many of the holes have now been resolved and I would recommend giving the framework another try to see how it performs. Right now the Xunit developers are busy working on V2 of Xunit, including a whole new backwards compatible API for tools such as NCrunch to integrate with. It isn't clear yet when this version of Xunit will be available, but I'm hoping to introduce direct support for this API shortly after it is fully released (therefore by-passing the Gallio integration). This means that if you do experience any problems with the Xunit integration, then there's a good chance they'll be fixed very soon and performance will likely also be improved.
1 user thanked Remco for this useful post.
yanglee on 8/9/2013(UTC)
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.022 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download