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

Notification

Icon
Error

Support for detecting test failing because of concurrent test problems
realmforge_studios
#1 Posted : Tuesday, April 23, 2013 11:14:32 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 4/23/2013(UTC)
Posts: 6
Location: Germany

I would like to have some support for finding problems with tests running concurrently.

When testing complex applications, it happens that some parts of the code unintentionally access shared resources during unit tests (e.g. writing/reading to a common config file). This makes tests failing unpredictably. The experienced result is usually:

- if you run only the failing test, it works like a charm.
- if you run all tests, one or some tests are failing for strange reasons.
- often, if you turn off parallel test execution, the problem vanishs.

In my experience, the error is often not clearly visible, e.g. since the place where the code fails is totally off the screen of the shared resource access. (Or in other words, if it would be that simple, it would have been mocked away already).

I propose a feature in NCrunch, where you can re-run in Debug mode the exact same test run setup that just ran. NCrunch should log at which thread which test case ran in which order and provide a way to re-run the last execution (that triggered because of the last edit operation), just this time in debug mode, stopping at exceptions and break points.
realmforge_studios
#2 Posted : Tuesday, April 23, 2013 11:43:00 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 4/23/2013(UTC)
Posts: 6
Location: Germany

Just want to add: This feature is not only helpfull finding concurrent problems, but also problems because of access to static variables which aren't cleared properly after the test.
Remco
#3 Posted : Tuesday, April 23, 2013 11:00:17 PM(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)
Thanks for the suggestion. Dealing with randomly failing tests is definitely a source of frustration with NCrunch (it affects me too), and I've been trying to think of ways to sort this out.

The difficulty in reconstructing a full test run and test set up state is that when executing tests concurrently, they may not always take the same time to execute the second time as they did the first, and execution time can have a big impact on execution sequence when tests are being run in parallel. Although a 'best effort' approach is certainly a possibility :)

A simpler approach that I've been considering is to try and give more information around test failures. When a test fails, NCrunch can remember the sequence of tests that were executed before it, and the tests that are being executed in parallel with it. At best, a replay option here would get close to what you've described. At least, the information NCrunch could provide might help with narrowing down the reason for failure. Let me know what you think.

Cheers,

Remco
wilhelmmedetz
#4 Posted : Monday, April 29, 2013 7:44:10 AM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 7/4/2012(UTC)
Posts: 35

Was thanked: 2 time(s) in 2 post(s)
I think, any information about test execution would help. Not only which tests were exected in parallel, but also which tests were executed in within the same test runner before failing test.
1 user thanked wilhelmmedetz for this useful post.
Remco on 4/29/2013(UTC)
realmforge_studios
#5 Posted : Monday, April 29, 2013 9:11:20 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 4/23/2013(UTC)
Posts: 6
Location: Germany

wilhelmmedetz's suggestion is definetely a good one and probably prerequisite to my original idea. Even only information about concurrent execution and test order can help narrowing down randomly failing tests.

Note, that although its good to know what tests were running in this particular test runner (to find bad static variable access), but also which tests ran in other test runners at what time and finished at what time (to find system-wide resource access). Kind of a global log..

The next logical step from there would be my original post's suggestion (as a best-effort. Perfect replayability is impossible anyway if any kind of system call outside the box is assumed).
Remco
#6 Posted : Monday, April 29, 2013 10:20:33 PM(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)
Thanks! This is well along the lines of what I was also thinking. NCrunch never executes tests concurrently within the same process, so all the parallel execution would need to be tracked at system level anyway (although it might be challenging to do this between two separate IDE instances).
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.047 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download