3

I have a test that I'm trying to run parallel in multiple browsers(IE, Chrome and Firefox).

[SetUp]
        public void TestInitialize()
        {
            //EnvironmentAccess.LoadEnvironment();

            // Create a new instance of the Firefox driver
            //driver = new FirefoxDriver();

            DesiredCapabilities capabilities = new DesiredCapabilities();
            capabilities = DesiredCapabilities.Firefox();
            capabilities.SetCapability(CapabilityType.BrowserName, "firefox");

        capabilities.SetCapability(CapabilityType.Platform, new Platform(PlatformType.Windows));

        driver = new RemoteWebDriver(new Uri("http://localhost:4444/wd/hub"), capabilities);
    }


[Test]
        public void SampleTest()
        {
            string url = "https://google.com";
            try
            {
                driver.Navigate().GoToUrl(url);
            }
//other test code 
}

[TearDown]
        public void TearDown()
        {
            driver.Quit();
            driver.Dispose();
        }

I can't figure out how to make it run across multiple browsers. I've seen it be done in java but i'm trying to do it through c#. I read about gallio but couldn't understand howto integrate it properly in my code.

user3703723
  • 229
  • 1
  • 2
  • 11

2 Answers2

0

When you're using remote webdriver, the browser that is used it dictated by the desired capabilities. When you construct your driver, you will need to provide the other browsers in the desired capabilities.

The browser that you want to use also needs to be installed and registered as capability of a node.

https://code.google.com/p/selenium/wiki/DesiredCapabilities

Michiel Bugher
  • 1,005
  • 1
  • 7
  • 23
0

Gallio is a great tool for launching execution runs, but you might want to explore using MBUnit as your testing framework alongside Selenium. When we approached this issue at work, we found NUnit to be fairly stubborn when it came to running tests in parallel reliably (if at all).

MBUnit is available as a Nuget package, so installation is easy. From there, you'd just need to re-tool your annotations on your methods as required.

I'll stipulate that MBUnit is pretty much a dead project at this point and hasn't seen active development in quite a while. With that said, we've seen a good bit of success in using it on my team. It's stable, performs well, and parallelization is nice and easy. It's worth some consideration given the status of the project, but I do recommend it.

tim-slifer
  • 1,068
  • 1
  • 9
  • 17