Road to parallel execution of selenium webdriver test scripts using multithreading

In this post you will learn to how to execute selenium webdriver test script on two browser parallel using multithreading.
package com.test;

import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.AfterClass;
import org.testng.annotations.Test;

public class GoogleSearchMultiThread extends Thread {

   private WebDriver driver;
   private String baseUrl;
   private String browsertype;

   public GoogleSearchMultiThread(String name, String browsertype) {
               this.browsertype = browsertype;

   public void run() {
        System.out.println("Thread- Started"
                                      + Thread.currentThread().getName());
        try {

          } catch (InterruptedException e) {
         } catch (Exception e) {
               // TODO Auto-generated catch block
        } finally {
       System.out.println("Thread- END " + Thread.currentThread().getName());

   // main method to create thread and run multiple thread
   public static void main(String[] args) {

               Thread t1 = new GoogleSearchMultiThread("Thread Firefox", "Firefox");
               Thread t2 = new GoogleSearchMultiThread("Thread IE", "IE");
               System.out.println("Starting MyThreads");
               System.out.println("Thread has been started");


   // set up method to initialize driver object
   public void setUp(String browsertype) throws Exception {

               if (browsertype.contains("IE")) {
                           File IEDriver = new File("IEDriverServer.exe");
                           driver = new InternetExplorerDriver();
               } else if (browsertype.contains("Firefox")) {
                           driver = new FirefoxDriver();
               baseUrl = "";
               driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);

   // test scripts
   public void testGoogleSearch() throws Exception {
               driver.get(baseUrl + "/");
               driver.findElement(By.cssSelector("#ab_as > div")).click();
               driver.findElement(By.xpath("//input[@value='Advanced Search']"))

   // tear down function to close browser
   public void tearDown() {


In above class I use multithreading concept of java, when you run test it will execute two thread of test on at firefox browser and other on Internet explorer browser.

Road to parallel execution of selenium webdriver test using testng

In this post you will learn how to run selenium webdriver test scripts parallel in more two environments using testng suite, testng has a feature by which we can create multiple instance of a single testng class file.

In below example, I created a selenium webdriver test script for google search. Which will run on two browsers firefox and IE.

Road to use variable from bootstrap file in Codeception test

In this post I will show you how to create global variable which can be use in any codeception test scripts file. Suppose that we have user name and password which need to be use in all test scripts for login to application.  This is good practices to put these values in one place instead of passing in multiple test case.
You should see that “_bootstrap.php” files are generated in folder “acceptance”,  “functional” , “unit” and at root of test folder.
You can create a variable in this files with any desire values and can be use in corresponding folders scripts.