Site Loader
Auckland, New Zealand
In the last post we discussed how selenium grid works and how to configure selenium grid in greater detail. In this post we will move further and try to run multiple tests in parallel in different environments like
  • Different Operating systems
  • Different browsers

Distributed architecture

The distributed architecture we will work will look something like this

Parallel execution

Parallel execution of test can be achieved using testing framework TestNG In TestNG there is an option called Parallel which you can see from here

Here is the complete video of the above discussion Here is the complete code from the above video

Parallel Execution Test Code

public class ParallelTest {

	// RemotewebDriver instance
	public static RemoteWebDriver driver;

	@BeforeTest
	@Parameters({ "platform", "browserName", "remoteurl" })
	public void beforeTest(String platform, String browserName, String remoteurl)
			throws MalformedURLException {

		DesiredCapabilities cap = null;

		if (browserName.equals("firefox")) {
			cap = new DesiredCapabilities().firefox();
			cap.setBrowserName("firefox");
		} else if (browserName.equals("chrome")) {
			cap = new DesiredCapabilities().chrome();
			cap.setBrowserName("chrome");
		}

		cap.setPlatform(Platform.WIN8_1);

		driver = new RemoteWebDriver(new URL(remoteurl), cap);

		driver.navigate().to("http://www.google.com");

	}

	@Test
	public void GoogleSearch() throws InterruptedException {

		driver.findElementByName("q").sendKeys("execute automation");

		driver.findElementByName("btnG").click();

		Thread.sleep(3000);
	}

	@Test
	public void ClickExecuteAutomation() {
		driver.findElementByPartialLinkText("Execute Automation").click();
	}

}

Thanks for reading the post and watching the video !!! Please leave your comments and let me know if there is anything I should update in this post. Thanks, Karthik KK

Post Author: Karthik kk

5 Replies to “Selenium Grid Parallel test execution”

  1. Hi Karthik,

    Topic is Selenium Grid Parallel test execution and the video is of Hidden control.

    Could you please upload the video of Selenium Grid Parallel.

    Thanks.

  2. Hi Karthik,

    I am using docker for selenium grid. Parallel execution is working fine but extent report is not able to capture all test cases. It captures only last test case. Could you please advise is there a feasible solution to capture all test cases in extent report ?

Leave a Reply to Atul Cancel reply

Your email address will not be published. Required fields are marked *