Hi Cliff,

Sorry for not replying sooner, got sidetracked on another project.
I appreciate your response, and observations.

Re:
2) I do  _driver.Quit();  in the teardown method.  It is my understanding 
quit does a close and dispose. (may bleed over into #1 later)
3) I just put sleep in there to buy a little time and to see how the tests 
were actually running for this example.  In my actual project I'm  handling 
waiting for specific projects just fine.
4) I wasn't really trying to take advantage of the data driven 
functionality at the time.  I've looked into it more lately and am using 
it, but didn't think it was an important issue in this example.

I think the most pressing issue is what you pointed out as #1, having set 
the driver to a field that would be shared among the threads.
Everything about this is new to me... C#, Selenium, MBUnit, so I appreciate 
your patience. 

Where would I put using(var driver = GetDriver(capabilities)) { // do stuff 
}?

Thank you in advance.
bg

On Friday, November 2, 2012 9:51:17 AM UTC-7, Cliff Burger wrote:
>
> 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/-/aLDmvD2H5wsJ.
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