Showing posts from August, 2013

Parallel Execution using TestNG

For Parallel execution ,we will be working on 3 different components as below:

A Factory class that will create WebDriver instances A Manager class that can be accessed to retrieve a WebDriver instance A TestNG listener that will be responsible for instantiating the WebDriver instance automatically
First we will create a Factory class which will create and return the desired webdriver object:

packageexecution.parallel; importorg.openqa.selenium.WebDriver;; importorg.openqa.selenium.firefox.FirefoxDriver;; classLocalDriverFactory { staticWebDriver createInstance(String browserName) { WebDriver driver = null; if(browserName.toLowerCase().contains("firefox")) { driver = newFirefoxDriver(); returndriver; } if(browserName.toLowerCase().contains("internet")) { driver = newInternetExplorerDriver(); returndriver; } if(browserName.toLowerCase().contains("chrome")) { driver = newChro…