Tuesday 7 January 2014

How to run tests in multiple browser parallel

--TBD

14 comments:

  1. please publish this answer

    ReplyDelete
    Replies
    1. This link will help u.
      http://abodeqa.wordpress.com/2013/02/21/how-to-execute-selenium-webdriver-test-cases-parallel-in-multiple-browser-using-testng-parameter-annotation/

      Delete
    2. By Using JVM also we can achieve this..

      Delete
    3. This link can help you :

      https://medium.com/automation-testing/selenium-grid-and-testng-d589127b2ab2

      Delete
    4. We can do by using multy threading in Java

      Delete
  2. may be this link help you

    https://groups.google.com/forum/#!topic/webdriver/D5q9y7w_Qm4

    ReplyDelete
  3. Topic: To run selenium test scripts in IE & FF parallel:
    You need to define "parallel" in your TestNG xml file and create a parameter and pass to your method.

    Suppose say you create this xml file as test.xml. Assume your class name is "YourClassName". You need to have two blocks for this class an you are passing parameter name= browser to your method.

    For ex: the test.xml file should have like this:















    –>


    You create a class with a method something like this:


    public class LaunchBrowser {

    WebDriver driver=null;


    // Pass parameter browser from test.xml
    @Parameters(“browser”)
    public void initiateBrowser(String browser){

    // compare browser to fire fox and then open firefox driver
    if(browser.equals(“Firefox”))
    {

    driver = new FirefoxDriver();
    }
    else
    {
    \ set path to the IE driver correctly here
    System.setProperty("webdriver.ie.driver", "\iexploredriver.exe");
    driver =new InternetExplorerDriver();
    }
    }

    Now create YourClassName class and call extend the above class something like this

    @Test
    public class YourClassName extends LaunchBrowser{

    public void gotoGoogle(){


    driver.get(“http://www.google.com");
    }
    }

    Now it should launch chrome and Firefox together and should go to google web site. Hope this helps

    ReplyDelete
    Replies
    1. Hi,
      Not able to view test.xml file here....
      Please repost.

      Delete
  4. using Groups

    @Test(group= {Functional, UI} )
    public static goToTweets()
    {
    //some code
    }

    ReplyDelete
  5. Adding in the previous post ..

    then in testng.xml includes that group









    ReplyDelete
  6. http://seleniumguru.in/?p=255

    Above link will give you brief programm with example

    ReplyDelete