I am trying to setup data driven multi-browser test with selenium grid and 
the MbUnit/Gallio test runner.  I read about how MbUnit can use 
IEnumeration to have data driven testcases 
here<http://stackoverflow.com/questions/1237933/usingfactories-alternative-in-mbunit-v3>.
 
 I have been able to get the sample Selenium Google search testcase to work 
across multiple browsers with the code 

        private IEnumerable<ICapabilities> ProvideCapabilities
        {
            get
            {
                yield return DesiredCapabilities.Firefox();
                yield return DesiredCapabilities.Chrome();
            }
        }
        [Test]
        public void testBrowser([Factory("ProvideCapabilities")] 
ICapabilities browser)
        {
            IWebDriver driver = new RemoteWebDriver(new 
Uri("http://127.0.0.1:4444/wd/hub";),
                                      browser);
            driver.Navigate().GoToUrl("http://www.google.com/";);
            IWebElement query = driver.FindElement(By.Name("q"));
            query.SendKeys("Bark");
            query.Submit();
            WebDriverWait wait = new WebDriverWait(driver, 
TimeSpan.FromSeconds(10));
            wait.Until((d) => { return 
d.Title.ToLower().StartsWith("bark"); });
            System.Console.WriteLine("Page title is: " + driver.Title);
            driver.Quit();
            System.Console.WriteLine("end of testBrowser");
        }

But when I try to expand on the idea with the cartesian product of the 
browser + data input as mentioned in the 
thread<http://stackoverflow.com/questions/1237933/usingfactories-alternative-in-mbunit-v3>the
 test times out, even though the browsers actually starts and performs 
the correct search

        private IEnumerable<ICapabilities> ProvideCapabilities
        {
            get
            {
                yield return DesiredCapabilities.Firefox();
                yield return DesiredCapabilities.Chrome();
            }
        }
        public IEnumerable<string> ProvideSearchString
        {
            get
            {
                yield return "Cheese";
                yield return "Bark";
            }
        }

        [Test]
        public void testBrowser([Factory("ProvideCapabilities")] 
ICapabilities browser, [Factory("ProvideSearchString")] string searchString)
        {
            IWebDriver driver = new RemoteWebDriver(new 
Uri("http://127.0.0.1:4444/wd/hub";),
                                      browser);
            driver.Navigate().GoToUrl("http://www.google.com/";);
            IWebElement query = driver.FindElement(By.Name("q"));
            query.SendKeys(searchString);
            query.Submit();
            WebDriverWait wait = new WebDriverWait(driver, 
TimeSpan.FromSeconds(10));
            wait.Until((d) => { return 
d.Title.ToLower().StartsWith(searchString); });
            System.Console.WriteLine("Page title is: " + driver.Title);
            driver.Quit();
            System.Console.WriteLine("end of testBrowser");
        }

I 

I was hoping someone might have a suggestion on whether what I'm trying 
makes sense and if this is the 'correct' way to achieve multi-browser 
regression testing with MbUnit/Gallio/SeleniumGrid2/C#

-- 
You received this message because you are subscribed to the Google Groups 
"MbUnit.User" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/mbunituser?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to