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

Notification

Icon
Error

SetUpFixture for specific namespace gets executed when running a single test in different namespace
nrjohnstone
#1 Posted : Wednesday, November 4, 2015 10:52:21 PM(UTC)
Rank: Member

Groups: Registered
Joined: 7/1/2015(UTC)
Posts: 12
Location: New Zealand

Thanks: 1 times
Was thanked: 2 time(s) in 2 post(s)
The documentation for NUnit states that a class with the SetUpFixture will run once before any tests in the namespace execute.

Our integration project has a separate namespace for the databases tests and has a class with SetUpFixture to create and drop the databases as required.

However we noticed with NCrunch alot of our other non database tests are running slowly now and after debugging I've found this to be that after running a single test from a different namespace, the SetUpFixture gets executed as well, even though no tests in that namespace are being run !

Remco
#2 Posted : Thursday, November 5, 2015 1:29:01 AM(UTC)
Rank: NCrunch Developer

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

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
Hi, thanks for posting.

Can you confirm which version of NUnit you are using?
nrjohnstone
#3 Posted : Thursday, November 5, 2015 7:26:48 PM(UTC)
Rank: Member

Groups: Registered
Joined: 7/1/2015(UTC)
Posts: 12
Location: New Zealand

Thanks: 1 times
Was thanked: 2 time(s) in 2 post(s)
Hi Remco, I'm using NUnit 2.6.3 with Visual Studio 2013 Update 4 and NCrunch 2.16.0.13
nrjohnstone
#4 Posted : Thursday, November 5, 2015 7:29:20 PM(UTC)
Rank: Member

Groups: Registered
Joined: 7/1/2015(UTC)
Posts: 12
Location: New Zealand

Thanks: 1 times
Was thanked: 2 time(s) in 2 post(s)
I've also confirmed that using the NUnit test runner to run an explicit test from a namespace outside of the one with SetUpFixture attribute and it does not get run, the same with Resharper v10. It only seems to be NCrunch that executes the SetUpFixture when running tests outside of the namespace where the SetUpFixture is supposed to apply.
Remco
#5 Posted : Friday, November 6, 2015 1:13:39 AM(UTC)
Rank: NCrunch Developer

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

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
1 user thanked Remco for this useful post.
nrjohnstone on 11/6/2015(UTC)
nrjohnstone
#6 Posted : Friday, November 6, 2015 1:40:58 AM(UTC)
Rank: Member

Groups: Registered
Joined: 7/1/2015(UTC)
Posts: 12
Location: New Zealand

Thanks: 1 times
Was thanked: 2 time(s) in 2 post(s)
Brilliant Remco, that fixes the issue :-)

Thanks again for an excellent product !
1 user thanked nrjohnstone for this useful post.
Remco on 11/6/2015(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.034 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download