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 NCrunch Developer
#10316
24 Apr 2017 13:17 UTC
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.
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.
Post a reply
Log in to reply.