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



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

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

Thanks: 44 times
Was thanked: 29 time(s) in 28 post(s)

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".

#2 Posted : Monday, April 24, 2017 1:17:11 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 606 times
Was thanked: 697 time(s) in 667 post(s)

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 (3)
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.016 seconds.