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

Notification

Icon
Error

Override [ExlusivelyUses] for specific test?
GreenMoose
#1 Posted : Monday, April 24, 2017 12:37:24 PM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 6/17/2012(UTC)
Posts: 507

Thanks: 145 times
Was thanked: 66 time(s) in 64 post(s)
Hi.

Is there a way I override the ExclusivelyUses so NCrunch run these tests in parallell, even though base class has ExclusivelyUses set?

My scenario is this: I have a lot of integration tests dealing with database and they derive from a base fixture e.g. "DatabaseTest". To avoid deadlocking issues I have added [ExclusivelyUses("DatabaseWrite")] for that "DatabaseTest" base class.

Now some of the tests (quite many due to TestcaseSource attribute usage) are only read operations or are not even touching database and I would like these to flag that "these are NOT exlusively using DatabaseWrite".

Thanks.
Remco
#2 Posted : Monday, April 24, 2017 1:17:11 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,

From what I can remember, NCrunch will always aggregate the ExclusivelyUses attribute values down through the inheritance structure. This means that once it's been declared on a base class, there isn't any way to then undeclare it on a descendant. Sorry, I can't think of any workaround here other than to change the design of the tests. It may be that you need to introduce a variation in your inheritance structure so that some of your integration tests have a different base class, allowing you to move the ExclusivelyUses declaration so it is more tightly targeted.
1 user thanked Remco for this useful post.
GreenMoose on 4/24/2017(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.019 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download