I Need to executed selenium UI tests using selenium grid on multiple node with different configurations. Currently I am able to execute tests only on one machine at the give time using the RemoteWebDriver and desired capabilities. My Code is as follows:
using NUnit.Framework;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium.Remote;
using System;
using System.Collections.Generic;
namespace ClassLibrary1.Test
{
[TestFixture]
public class Test1 : BaseTestClass
{
public RemoteWebDriver driver = null;
[SetUp]
public void setup()
{
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.SetCapability(CapabilityType.BrowserName, "chrome");
capabilities.SetCapability(CapabilityType.Platform, new Platform(PlatformType.Windows));
driver = new RemoteWebDriver(new Uri(" http://152.17.100.217:5454/wd/hub"), capabilities);
driver.Manage().Window.Maximize();
}
[TearDown]
public void teardown()
{
driver.Quit();
}
[Test]
//[Parallelizable]
public void test1()
{
driver.Navigate().GoToUrl("https://www.google.com");
Thread.Sleep(5000);
IWebElement query = driver.FindElement(By.Name("q"));
query.SendKeys("test");
query.Submit();
Thread.Sleep(15000);
}
[Test]
//[Parallelizable]
public void test2()
{
driver.Navigate().GoToUrl("https://www.google.com");
Thread.Sleep(5000);
IWebElement query = driver.FindElement(By.Name("q"));
query.SendKeys("selenium ");
query.Submit();
Thread.Sleep(15000);
}
}
}
I need to execute around 250+ tests on servers via VSTS and also need to implement the selenium grid for different configurations. With this I am only able to execute these tests on one server at a time then I need to change the capabilities manually to execute it on another server. What can I do to make it run on multiple machine at same time. I know that is possible with Java using the xml file and adding the nodes for machine configurations and tests files but not able to do it using c#. After that I intend to trigger this using the VSTS build. Is there any way to achieve it ??