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

Notification

Icon
Error

Problems with testing static service
Stanislaw
#1 Posted : Wednesday, August 10, 2016 7:12:33 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 4/22/2016(UTC)
Posts: 6
Location: Ukraine

Thanks: 1 times
Hello!
A some of my tests using 3rd party library with static initialization of its service. So this service have an Init method with some arguments.
But I need to use it with a separate set of arguments for each test. When I running tests (even in non-parallel mode) I receive an error from random test (for each test set running) about that service is already initialized.
I understand that this case, may be, not related to NCrunch, but any answer or recomendation how to use fully separate static resource for each test will be highly appreciated.

P.S. I use XUnit
Remco
#2 Posted : Wednesday, August 10, 2016 11:51:26 AM(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, thanks for posting.

If I understand this problem correctly, you wish to isolate each individual test within its own process, as the execution of a test will 'fix' this service into a state where it cannot be reinitialised inside the same test process and cannot be changed.

Applying the Isolated attribute to these tests should allow you to work around this by forcing the NCrunch engine to place each of the tests inside its own process. Note that this will cause considerable loss in performance.

In case I haven't understood the problem correctly, I recommend having a read up on how NCrunch's test environment is different from other test runners. If the problem is being caused by a state or sequence related issue in the NCrunch test environment, it's worth being familiar with this.
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.025 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download