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

Possible to make test run in parallel on same machine

1 Answer 86 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Martin
Top achievements
Rank 1
Martin asked on 01 Jun 2012, 10:40 AM
Hi

Does the Telerik test framework support running tests in parallel or is that a path with a road block in the end? :)

So far I've come up with this, but it doesn't really work and i can't figure out if it's just not going to work with Telerik or if I'm doing something wrong.

The last test can just be repeated a couple of times and i have DegreeOfParalallism = 2 in AssemblyInfo.cs

I'm in the process of investigating different ways of making our suite run faster, looking forward to your response.

[TestFixture]
    [Parallelizable(TestScope.Descendants)]
    public class TelerikMbUnit1 : BaseTest
    {
        ConcurrentDictionary<string, Browser> browserDict = new ConcurrentDictionary<string, Browser>();
 
        #region [ Setup / TearDown ]
 
        [SetUp]
        public void MyTestInitialize()
        {
            Initialize(false);
 
            // Launch new browser
            Manager.LaunchNewBrowser(BrowserType.FireFox, true);
            Browser browser = Manager.ActiveBrowser;
 
            browserDict.TryAdd(TestContext.CurrentContext.TestStep.ToString(), browser);
        }
 
        [TearDown]
        public void MyTestCleanUp()
        {
    //      this.CleanUp();
 
            Browser browser;
            browserDict.TryRemove(TestContext.CurrentContext.TestStep.ToString(), out browser);
            browser.Close();
        }
 
        [FixtureTearDown]
        public void FixtureCleanup()
        {
            // This will shut down all browsers if
            // recycleBrowser is turned on. Else
            // will do nothing.
            ShutDown();
        }
 
        #endregion
 
        [Test]
        public void SampleWebAiiTest0()
        {
            Browser browser = browserDict.Where(d => d.Key == TestContext.CurrentContext.TestStep.ToString()).Single().Value;
 
            // The active browser
            browser.NavigateTo("http://www.google.dk");
 
            // Find the google search box and set it to "Telerik";
            browser.Find.ByName<HtmlInputText>("q").Text = "Telerik";
 
            // Click the Search button
            browser.Find.ByName<HtmlButton>("btnK").Click();
 
            // Validate the search contain the 'Telerik' text
            Assert.IsTrue(browser.ContainsText("Telerik"));
        }

1 Answer, 1 is accepted

Sort by
0
Anthony
Telerik team
answered on 01 Jun 2012, 04:19 PM
Hello Martin,

The framework doesn't include a test runner; you are essentially creating Microsoft Coded Unit Tests that can only be run by a Microsoft tool (MSTest, Visual Studio, Microsoft Test Manager, etc.).

Your suggested approach is a big challenge for any functional test written to interact with the browser's UI (not just the framework or Test Studio). What if each test needs access to the keyboard or mouse at the same time? This functionality is simply not a built-in feature in either the framework or the full version of Test Studio.

I'm sure there are complicated work-arounds out there, however we don't have a ready-made solution to offer you. My colleague mentioned a high level approach where you hold and release desktop access with code that surrounds other code that requires it.

Greetings,
Anthony
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
Tags
General Discussions
Asked by
Martin
Top achievements
Rank 1
Answers by
Anthony
Telerik team
Share this question
or