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

Notification

Icon
Error

DomainUnload is not fired/class finalizers not executed on test runner host exit
liudas
#1 Posted : Friday, October 25, 2013 7:40:21 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 10/25/2013(UTC)
Posts: 1
Location: Lithuania

Hi,
I need to execute clean up code to free external resources after all test are executed. NCrunch handles AssemblyInitialize/AssemblyCleanup differently from mstest runner. As advised in Test Runner Re-use documentation part I introduced bool flag to avoid multiple long running Initialization calls. When test host exits (or is killed) no AppDomain.CurrentDomain.DomainUnload and AppDomain.CurrentDomain.ProcessExit events are fired nor class Finalizers are executed.
Remco
#2 Posted : Friday, October 25, 2013 8:39:18 AM(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)
Hi, thanks for posting!

NCrunch doesn't have a mechanism for executing clean up code on termination of a test runner process, for the simple reason that no cleanup scenario can ever be 100% reliable in a way that NCrunch can control. There are many situations that can result in test runner processes being suddenly terminated - ranging from those caused by code under test (i.e. stack overflows, out of memory exceptions) through to external factors (i.e. interference from other processes/applications). While such situations are rare when tests are deliberately executed serially with other test runners, the high level of concurrency and continuous execution performed by NCrunch make such scenarios much more likely.

To execute cleanup code using NCrunch, you will need to use try/finally structures around the tests involved. Depending on the nature of the resources involved, you may also be able to look into other options such as structuring tests to clean up when they begin executing (i.e. mopping up after the last test run).
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.027 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download