locked
unit test problem: maximum test function is 38 RRS feed

  • Question

  • hi,

    i am using VS 2008 and have created unit test.

    i can run only 38th test function and the  39 th function always returns exception.

    if i replace between the function in the 39 th place and the function  in 38, i get exception. although the function in 39 th place runs fine few seconds ago.

    this is the exception (i get this exception between the tests and not in test function): 

    Initialization method DeGeLWcfUniTest.AxisNodeWCFTest.MyTestInitialize threw exception. System.TimeoutException:  System.TimeoutException: The open operation did not complete within the allotted timeout of 00:01:00. The time allotted to this operation may have been a portion of a longer timeout. --->  System.TimeoutException: The socket transfer timed out after 00:00:59.9990000. You have exceeded the timeout set on your binding. The time allotted to this operation may have been a portion of a longer timeout. --->  System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.

     

    stack trace


    System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)

    System.ServiceModel.Channels.SocketConnection.ReadCore(Byte[] buffer, Int32 offset, Int32 size, TimeSpan timeout, Boolean closing)

    System.ServiceModel.Channels.SocketConnection.ReadCore(Byte[] buffer, Int32 offset, Int32 size, TimeSpan timeout, Boolean closing)

    System.ServiceModel.Channels.SocketConnection.Read(Byte[] buffer, Int32 offset, Int32 size, TimeSpan timeout)

    System.ServiceModel.Channels.DelegatingConnection.Read(Byte[] buffer, Int32 offset, Int32 size, TimeSpan timeout)

    System.ServiceModel.Channels.ConnectionUpgradeHelper.InitiateUpgrade(StreamUpgradeInitiator upgradeInitiator, IConnection& connection, ClientFramingDecoder decoder, IDefaultCommunicationTimeouts defaultTimeouts, TimeoutHelper& timeoutHelper)

    System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.SendPreamble(IConnection connection, ArraySegment`1 preamble, TimeoutHelper& timeoutHelper)

    System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.DuplexConnectionPoolHelper.AcceptPooledConnection(IConnection connection, TimeoutHelper& timeoutHelper)

    System.ServiceModel.Channels.ConnectionPoolHelper.EstablishConnection(TimeSpan timeout)

    System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.OnOpen(TimeSpan timeout)

    System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.OnOpen(TimeSpan timeout)

    System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)

    System.ServiceModel.Channels.ServiceChannel.OnOpen(TimeSpan timeout)

    System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)

    System.ServiceModel.Channels.ServiceChannel.CallOpenOnce.System.ServiceModel.Channels.ServiceChannel.ICallOnce.Call(ServiceChannel channel, TimeSpan timeout)

    System.ServiceModel.Channels.ServiceChannel.CallOnceManager.CallOnce(TimeSpan timeout, CallOnceManager cascade)

    System.ServiceModel.Channels.ServiceChannel.EnsureOpened(TimeSpan timeout)

    System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)

    System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)

    System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)

    System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

    System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)

    System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)

    DeGeLWcfUniTest.AxisNodeWCF.IAxisNodeWCF.Login(String userName, String pasword)

    DeGeLWcfUniTest.AxisNodeWCF.AxisNodeWCFClient.Login(String userName, String pasword) in C:\Code.16.07.2010_20.00\Code\DeGeLWcfUniTest\Service References\AxisNodeWCF\Reference.cs: line 195

    DeGeLWcfUniTest.AxisNodeWCFTest.MyTestInitialize() in C:\Code.16.07.2010_20.00\Code\DeGeLWcfUniTest\AxisNodeWCFTest.cs: line 49


    please help ....

    • Moved by SamAgain Tuesday, July 20, 2010 7:08 AM unit test question (From:Building Development and Diagnostic Tools for .Net)
    Monday, July 19, 2010 7:04 PM

Answers

  • Also make sure you close up on your WCF connections when running unit tests. I hit this issue last week and your error with the 1 minute timeout seems like the same one i got to. Basically after running some number of unit test cases like 16 or something, every test cases after that would fail afterwards with a 1 minute time out.

    It was because I did this

    MyChannel p = new MyChannel();

    and not this

    MyChannel p = new MyChannel();

    p->Close();

    Monday, August 9, 2010 7:41 AM

All replies

  • Hi

    Looking at the stack trace it indicates that "You have exceeded the timeout set on your binding". . The unit tests fails after running for a minute, and is not limited to the number of tests that you can run.

    Is  your test class using the same WCF Channel for all tests?

     

     


    Johan van Rhyn - Please remember to mark the replies as answers if you found them helpful.
    Friday, July 30, 2010 7:06 AM
  • Also make sure you close up on your WCF connections when running unit tests. I hit this issue last week and your error with the 1 minute timeout seems like the same one i got to. Basically after running some number of unit test cases like 16 or something, every test cases after that would fail afterwards with a 1 minute time out.

    It was because I did this

    MyChannel p = new MyChannel();

    and not this

    MyChannel p = new MyChannel();

    p->Close();

    Monday, August 9, 2010 7:41 AM