Question

I'm currently using Selenium Webdriver and developing my tests in Visual Studio 2012 with C#. I've successfully executed a remote test by using the following code:

public static void Test_RemoteWebDriver()
       {
        string url = "http://11.11.11.11:4444/wd/hub";

        DesiredCapabilities ieCapibility = DesiredCapabilities.InternetExplorer();
        ieCapibility.SetCapability("ignoreProtectedModeSettings", true);
        IWebDriver driver = new RemoteWebDriver(new Uri(url), ieCapibility);
        driver.Navigate().GoToUrl("http://www.google.com/");           
        driver.Quit();
       }

What I want to do now is to use one machine as the automation controller and execute the tests on multiple remote machines. To clarify, I want to have the Selenium code on my controller machine but be able to run the test on multiple remote machines. How do I do this? I'm also using NUnit to run my tests but I understand this may not be the best solution for parallel testing. What would be the best framework to run remote Selenium tests? Many Thanks for any help, John

Was it helpful?

Solution

It's been a while so here's what I ended up doing. I ended up using NUnit to run the tests. Now my automation copies both NUnit and Selenium files to the remote machine, runs the automation there and copies the results file back to the controller machine. Works well for my needs. John

OTHER TIPS

What I've done, I'm not sure if this is the best approach, is adding an entry for each server I want to test in the app.config, within the appsettings section, as follows:

 <!-- Server URLs to test  -->    
<add key="ApplicationUrl_DEV" value="http://localhost:44404"/>
<add key="ApplicationUrl_TEST" value="http://testserver:44404"/> 

And then in the test class, I add the attributes as:

[TestFixture("ApplicationUrl_DEV", "DEV")]
[TestFixture("ApplicationUrl_TEST", "TEST")]
public abstract class Executer // Test class

Each test method in the class will execute N times, once for each ´TestFixture´ attribute. After this, you must overload the class constructor:

protected Executer(string urlKey, string environment)
{
     BaseUrl = ConfigurationManager.AppSettings[urlKey];
     Environment = environment;
}

In this scenario, urlKey is the first value of the current TestAttribute, and environment is the second one. So, having this, I get the URL of my current server and I use it as my base url:

BaseUrl = ConfigurationManager.AppSettings[urlKey];
Environment = environment;

and "Environment" for logging purposes.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top