bertnz

Hi everyone,

I have had this situation a couple of times and I was wondering if anyone knows anything which could help me.

I am running my unit tests using Team Build and everything is going nicely until I get to a test which times out giving the following error:

Exceeded specified execution timeout period of '300' seconds on Agent 'W2456'.

The rest of the tests in the class then all fail instantly with the wollowing exception

Class Initialization method RaceO.Tests.AdminSystemTests.SystemAdminTests.Init threw exception. System.Threading.ThreadAbortException: System.Threading.ThreadAbortException: Thread was being aborted..

at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestExecuter.RunClassInitializeMethod()

The following class works and the tests resume working again subsequently.

I understand that initial test shouldn't have timed out but I wouldn't have thought it would break the rest of them

Any ideas

I am using Visual Studio 2005 2.0.50727.

cheers,

Robert




Re: Visual Studio Team System - Testing Class Initialization method ..Init threw exception.. Thread was being aborted.

LKRUGER MSFT

Robert,

It looks like we enfore a timeout of 5 minutes for each test method (when not in debugging mode). I agree that timeouts should fail gracefully and not fail the other tests. Here is what I did to try to repro the issue and also a workaround that might be helpful.

Repro:

I can't seem to reproduce your results exactly. Here is what I did: I created a very simple unit test with two test methods. The first sleeps for 500 seconds and the second one doesn't do anything. If I run this, I get a timeout on the first method, but the second one succeeds. Can you create a simple test that simulates your failure so that I can investigate this a little further

Workaround:

One thing that may get you through your problem is setting a higher timeout on the test method. You can do this by adding an attribute to the TestMethod, ex [Timeout(600000), TestMethod]. This would raise the timeout from 5 minutes to 10 minutes.

Thanks,

Lonny