This may be a more appropriate question for the Selenium users group. We 
use mbunit instead of other frameworks for some of the same reasons you 
appear to be using it: images, dynamic factories, parallelism. 

There are several problems with the code you've provided. 

1) You set the driver to a field that would be shared amongst the threads.
2) You do not close or dispose the browser. 
3) Thread.sleep! Google "webdriver wait". Always wait for some condition to 
be satisfied, typically an element to load.
4) Your data driven tests don't take advantage of the data driven 
functionality.  

For the Webdriver bit,

using(var driver = GetDriver(capabilities)) {
// do stuff with driver
}




On Wednesday, October 31, 2012 4:09:37 PM UTC-7, Brian George wrote:
>
> 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/-/2gqvhlbpMa0J.
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