This is a migrated thread and some comments may be shown as answers.

All pipe instances are busy

2 Answers 744 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Rob
Top achievements
Rank 1
Rob asked on 13 Jul 2011, 05:23 PM
Hi,

I am running test framework 2010.3.1109.  I have the same issue when I tried version 2011.1.609.  I am using TeamCity and nunit to run the automation tests.

We typically run a set of 3 to 7 tests (one story) and then shutdown the browser for a clean start on the next story's tests.

Chrome runs fine.  However both IE 8 and FireFox 3.6 exhibit the following problems:

Whenever we shut down the browser by calling ShutDown() we get this exception: System.Threading.ThreadAbortException: Thread was being aborted The tests continue to run.  However eventually we get the following exception: System.IO.IOException: All pipe instances are busy At this point the browsers open but do not navigate to the starting URL.

My guess is that the aborted threads are leaving a pipe instance open, and that eventually the server runs out of pipes.
I can handle the problem by putting in a sleep after each shutdown.  However this adds a lot of time to our tests.  In some cases I need a sleep as long as 30 seconds.  At least I think this will handle the problem.  I am trying the 30 second sleep now.  Also the ThreadAbortExceptions clutter the logs.

Are there any better solutions?

Rob

2 Answers, 1 is accepted

Sort by
0
Cody
Telerik team
answered on 18 Jul 2011, 11:37 PM
Hi Rob,

Can you share with us how you've wired up your tests? Here's a the way we recommend structuring NUnit tests:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
 
using ArtOfTest.WebAii.Controls.HtmlControls;
using ArtOfTest.WebAii.Controls.HtmlControls.HtmlAsserts;
using ArtOfTest.WebAii.Core;
using ArtOfTest.WebAii.ObjectModel;
using ArtOfTest.WebAii.TestAttributes;
using ArtOfTest.WebAii.TestTemplates;
using ArtOfTest.WebAii.Win32.Dialogs;
 
using ArtOfTest.WebAii.Silverlight;
using ArtOfTest.WebAii.Silverlight.UI;
 
using NUnit.Framework;
using Core = NUnit.Core;
 
namespace WebAiiCodedTests
{
    /// <summary>
    /// Summary description for TelerikNUnitTest1
    /// </summary>
    [TestFixture]
    public class TelerikNUnitTest1 : BaseTest
    {
 
        #region [Setup / TearDown]
 
        /// <summary>
        /// Initialization for each test.
        /// </summary>
        [SetUp]
        public void MyTestInitialize()
        {
            #region WebAii Initialization
 
            // Initializes WebAii manager to be used by the test case.
            // If a WebAii configuration section exists, settings will be
            // loaded from it. Otherwise, will create a default settings
            // object with system defaults.
            //
            // Note: We are passing in a delegate to the NUnit's TestContext.Out.
            // WriteLine() method. This way any logging
            // done from WebAii (i.e. Manager.Log.WriteLine()) is
            // automatically logged to same output as NUnit.
            //
            // If you do not care about unifying the log, then you can simply
            // initialize the test by calling Initialize() with no parameters;
            // that will cause the log location to be picked up from the config
            // file if it exists or will use the default system settings.
            // You can also use Initialize(LogLocation) to set a specific log
            // location for this test.
 
            // Pass in 'true' to recycle the browser between test methods
            Initialize(false, new TestContextWriteLine(Core.TestContext.Out.WriteLine));
 
            // If you need to override any other settings coming from the
            // config section or you don't have a config section, you can
            // comment the 'Initialize' line above and instead use the
            // following:
 
            /*
 
            // This will get a new Settings object. If a configuration
            // section exists, then settings from that section will be
            // loaded
 
            Settings settings = GetSettings();
 
            // Override the settings you want. For example:
            settings.DefaultBrowser = BrowserType.FireFox;
 
            // Now call Initialize again with your updated settings object
            Initialize(settings, new TestContextWriteLine(Core.TestContext.Out.WriteLine));
 
            */
 
            #endregion
 
            //
            // Place any additional initialization here
            //
        }
 
        /// <summary>
        /// Clean up after each test.
        /// </summary>
        [TearDown]
        public void MyTestCleanUp()
        {
            //
            // Place any additional cleanup here
            //
 
            #region WebAii CleanUp
 
            // Shuts down WebAii manager and closes all browsers currently running
            this.CleanUp();
 
            #endregion
        }
 
        /// <summary>
        /// Called after all tests in this class are executed.
        /// </summary>
        [TestFixtureTearDown]
        public void FixtureCleanup()
        {
            // This will shut down all browsers if
            // recycleBrowser is turned on. Else
            // will do nothing.
            ShutDown();
        }
 
        #endregion
 
        [Test]
        public void SampleWebAiiTest()
        {
            // Launch a browser instance
            Manager.LaunchNewBrowser(BrowserType.InternetExplorer);
 
            // The active browser
            ActiveBrowser.NavigateTo("http://www.google.com");
 
            // Find the google search box and set it to "Telerik";
            Find.ByName<HtmlInputText>("q").Text = "Telerik";
 
            // Click the Search button
            Find.ByName<HtmlInputSubmit>("btnG").Click();
 
            // Validate the search contain the 'Telerik' text
            Assert.IsTrue(ActiveBrowser.ContainsText("Telerik"));
        }
    }
}

Please note how things are divided into the following sections:
[SetUp]
[TearDown]
[TestFixtureTearDown]
[Test]

There can be multiple [Test]'s but there should only be one of the other three for each given namespace and [TestFixture].

Greetings,
Cody
the Telerik team
Register today for a live 'What's New in Test Studio R1 2011 SP2' event on Tuesday, July 19 at 2pm EST!

Have you looked at the new Online User Guide for Telerik Test Studio?
0
Rob
Top achievements
Rank 1
answered on 01 Aug 2011, 04:34 PM
That did the trick! Thanks.

The key seems to have been that we were calling Intialize and Cleanup only once per class, i.e. in TestFixtureSetup and TestFixtureTearDown respectively.

We now call them once per test, i.e. in SetUp and TearDown.

We still open the browser only once per class by setting recycle to true in setup.

We no longer see the "All pipe instances busy..." error.

Rob
Tags
General Discussions
Asked by
Rob
Top achievements
Rank 1
Answers by
Cody
Telerik team
Rob
Top achievements
Rank 1
Share this question
or