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

Notification

Icon
Error

xUnit Test Collections
roufamatic
#1 Posted : Thursday, April 30, 2015 6:05:49 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 4/30/2015(UTC)
Posts: 1
Location: United States of America

I have a bunch of tests under a single Collection umbrella. The purpose of the collection is to stand up a database for all the tests that need it. My test classes are all marked with the [Collection] attribute.

I'm finding that NCrunch is spinning up the database multiple times for these tests -- and doing so while tests are in the middle of their test run. This of course causes the tests to fail.

I set it up so that NCrunch only has 1 CPU / 1 thread for tests and disabled parallel execution but the problem persists.

VS 2013, NCrunch 2.14.0.8
Remco
#2 Posted : Thursday, April 30, 2015 10:55:18 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,983

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
Hi, thanks for sharing this issue.

For NCrunch to be able to maintain a mutable pipeline of tests to execute, it breaks up the list of tests into batches and calls into the test runner many times. You'll be able to see this behaviour if you examine the list of tests inside the Processing Queue Window.

Unfortunately there is no way to disable this. It's required in order for the runner to function. The fresh calls into xunit will result in new test collections being initialised, which in turn will rebuild your database with each batch run.

The only solution to this is to redesign the test suite. A possible solution is to have the test suite detect any pre-existing database that isn't wanted/needed for the test run and tear this down at the beginning of the run, prior to building a new database that can be used for the run. You can put a gate on this code using a static field that will prevent it from running more than once for the same process. Use of a test collection in this situation is optional but probably not required.
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.027 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download