It appears I'm able to get multiple tests to run simultaneously, but I've 
run into some issues.

1. Failed assertions tend to cause the browser to close and thus the grid 
just sits there until the session expires.
2. The tests don't seem to run independently.  Three different browsers 
open, but one of them will navigate to one url, then another, while a 
different browser never loads a webpage.

using System;
using System.Collections.Generic;
using System.Configuration;
using System.Threading;
using Gallio.Framework;
using MbUnit.Framework;
using OpenQA.Selenium.Remote;


namespace RR.Tests
{
    [TestFixture]
    [Parallelizable]
    public class Testing
    {

        private CRM.ScreenShotRemoteWebDriver _driver;
        private string TCName;

        //[FixtureSetUp]
        [SetUp]
        public void FSetup()
        {
            Console.WriteLine("Fixture Setup");
            String var = Environment.GetEnvironmentVariable("BaseURL");
            if (var == null)
                var = ConfigurationManager.AppSettings["environment"];
            CRM.Common.CRMTestSite = var + 
ConfigurationManager.AppSettings["crm_site"];
            Common.RevenueRadarTestSite = var + 
ConfigurationManager.AppSettings["rr_site"];
            Common.Remote = new 
Uri(ConfigurationManager.AppSettings["remote"]);
        }

        public IEnumerable<object> Firefox()
        {
            yield return DesiredCapabilities.Firefox();
        }
        public IEnumerable<object> Chrome()
        {
            yield return DesiredCapabilities.Chrome();
        }
        public IEnumerable<object> InternetExplorer()
        {
            yield return DesiredCapabilities.InternetExplorer();
        }

        [TearDown]
        public void TearDown()
        {
            Console.WriteLine("TearDown");
            if 
(TestContext.CurrentContext.IsTriggerEventSatisfied(TriggerEvent.TestFailed))
            {
                TestLog.EmbedImage(TCName + ".jpg", _driver.screenshot());
            }
            _driver.Quit();
        }

        [Test, Factory("Chrome")]
        public void One(DesiredCapabilities cap)
        {
            TCName = new System.Diagnostics.StackFrame().GetMethod().Name;
            _driver = new CRM.ScreenShotRemoteWebDriver(Common.Remote, cap);
            _driver.Manage().Cookies.DeleteAllCookies();
            _driver.Navigate().GoToUrl("http://yahoo.com";);
            Thread.Sleep(3000);
            Assert.AreEqual("a", "b");
            Thread.Sleep(3000);
            Console.WriteLine("two");
        }
        [Test, Factory("Firefox")]
        public void Two(DesiredCapabilities cap)
        {
            TCName = new System.Diagnostics.StackFrame().GetMethod().Name;
            _driver = new CRM.ScreenShotRemoteWebDriver(Common.Remote, cap);
            _driver.Manage().Cookies.DeleteAllCookies();
            _driver.Navigate().GoToUrl("http://google.com";);
            Thread.Sleep(6000);
            Console.WriteLine("two");
        }
        [Test, Factory("InternetExplorer")]
        public void Three(DesiredCapabilities cap)
        {
            TCName = new System.Diagnostics.StackFrame().GetMethod().Name;
            _driver = new CRM.ScreenShotRemoteWebDriver(Common.Remote, cap);
            _driver.Manage().Cookies.DeleteAllCookies();
            _driver.Navigate().GoToUrl("http://dealersocket.com";);
            Thread.Sleep(6000);
            Console.WriteLine("three");
        }
    }
}

bg

-- 
You received this message because you are subscribed to the Google Groups 
"MbUnit.User" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/mbunituser/-/CrumfhOMuwAJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/mbunituser?hl=en.

Reply via email to