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

Notification

Icon
Error

NCrunch Atomic attribute
aignas
#1 Posted : Monday, July 24, 2017 12:06:08 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 7/24/2017(UTC)
Posts: 5
Location: Lithuania

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)
Hello,

I have a question on how one of the latest additions to NCrunch works regarding the XUnit v2 fixtures.

I am trying out the Atomic for running acceptance tests, that have fixtures with really long setup times because a lot of data is being loaded into memory. When I am running it with R# test runner, the fixture is being reused in between the test runs and as a result the tests run in a reasonable amount of time, once the setup is done.

However, I noticed, that this is not the case for NCrunch. My only explanation is that it is recreating the fixture every time it is running a single test from those classes that have acceptance tests. I have marked the acceptance test classes with the atomic attribute, but have not seen any change. Should I mark the fixture as atomic instead? The fixture itself is thread safe.

All the best,
Ignas
Remco
#2 Posted : Monday, July 24, 2017 1:21:49 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 929 times
Was thanked: 1256 time(s) in 1169 post(s)
Hi Ignas,

The Atomic attribute only works when applied at fixture or assembly level. I'm not sure how your acceptance tests are structured, but the attribute usually should be placed on the same class containing the methods that use the Xunit attributes (like Fact).

My understanding of the design of Xunit is that it will usually create a new fixture instance for each call to every method on the fixture. So if you have a fixture containing three 'Fact' methods, then the fixture constructor will be called 3 times, once for each Fact. This should be the same behaviour as under Resharper, since both NCrunch and Resharper invoke Xunit for this handling and Xunit encapsulates this behaviour completely.

A way you can check whether AtomicAttribute is being detected by NCrunch is to turn on the 'Is Atomic' column in the Tests Window and check whether the tests you've marked up are considered to be atomic.
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.026 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download