Click here to Skip to main content
13,052,342 members (57,512 online)
Click here to Skip to main content
Add your own
alternative version


8 bookmarked
Posted 1 Dec 2009

Running Selenium HTML (Selenese) Test Cases in Parallel

, 1 Dec 2009
Rate this:
Please Sign up or sign in to vote.
This article will explain how to reduce time for the execution of Selenium HTML test cases without using Selenium Grid.


This article explains how to run Selenium HTML (Selenese) based test suites in parallel reducing the execution time without using Selenium Grid.


Currently Selenium Grid offers running Selenium tests written in C#, Java, Ruby, and PHP. But there are no client drivers available for Selenese test cases. The idea presented in this article is a workaround for running the Selenese test cases in parallel for reducing the execution time.

Real Scenario: Before this approach, we executed our Selenese tests in Selenium Functional Test Runner and it took almost 2 hours to execute 8 test suites parallel in a browser. With this approach, we have reduced the time to 15 minutes to execute the same 8 test suites.

Using the Code

The attached zip file is a sample ANT build script that executes the test suites by initializing them in different Selenium Remote Controls in parallel. To setup the environment, you need the following tools to be installed on your machine :

  • ANT
  • Psexec
  • Selenium Remote Control
  • Subversion (optional: if the test cases are in subversion repository)

The following snippet sets the required paths according to your environment. E.g. path to Selenium Server, base URL, path to Selenium tests and path to save generated Selenium reports:

<!-- Path to Selenium Server Binaries-->
<property name="SeleniumServerPath" value="C:\Path-to-Selenium-Server" />
<!--Path to base url-->
<property name="baseURL" value="https://url-to-your-application"/>
<!--<Path to Selenium Tests-->
<property name="SeleniumTestsPath" value="C:\Path-to-SeleniumTests"/>
<!--Path to Selenium Results-->
<property name="SeleniumReports" value="C:\Path-to-Reports" />

The following snippet updates the test files from subversion and calls the target for FirstTestSuite file:

<!-- This target will be used to update your selenium tests from Subversion -->
<target name="svn">
<exec dir="${SeleniumTestsPath}" executable="svn">
<arg line="update --username usr --password pwd" />
<antcall target="FirstTestSuite">

The following snippet initializes the first Selenium Server on port 4444 and second Selenium Server on port 4445 to execute the first and second test suite file in parallel. (Note: Place the user extension file in the same folder where test suite file is located.)

Please observe that Selenium Server is initialized using psexec so that ant can get the control back to initialize the second Server. Moreover, a sleep time of 15 seconds is included in order to have sufficient time for first Selenium Remote control to prepare the new Firefox profile before initializing the second Selenium Remote Control. Otherwise, it will throw an error that Firefox profile cannot be created.

<target name="FirstTestSuite">
<exec dir="${SeleniumServerPath}" executable="psexec.exe" spawn="true">
<arg line="-d -i java -jar
selenium-server.jar -port 4444 -singlewindow -htmlSuite *firefox ${baseURL}
${SeleniumReports}\Results_FirstTestSuite.html" /> 
<sleep seconds="15" />

<target name="SecondTestSuite">
<exec dir="${SeleniumServerPath}" executable="psexec.exe" spawn="true">
<arg line="-d -i java -jar
selenium-server.jar -port 4445 -singlewindow -htmlSuite *firefox ${baseURL}
${SeleniumReports}\Results_SecondTestSuite.html" /> 
<sleep seconds="15" />


Points of Interest

Large test suite files can be divided into smaller parts in order to execute them in parallel. This approach helps until Selenium Grid comes with an HTML client driver to execute the Selenese test cases in parallel.


  • 1st December, 2009: Initial post


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Obaid Malik
Pakistan Pakistan
No Biography provided

You may also be interested in...


Comments and Discussions

GeneralMy vote of 4 Pin
psamagal6-Dec-12 10:12
memberpsamagal6-Dec-12 10:12 
Questionwhat is the way to run it? Pin
Tanvir Afzal14-Nov-12 22:47
memberTanvir Afzal14-Nov-12 22:47 
QuestionCant get multiple windows opened Pin
krishnam_selenium9-Jul-12 23:25
memberkrishnam_selenium9-Jul-12 23:25 
Questionerror in IE Pin
Member 827595922-Nov-11 11:37
memberMember 827595922-Nov-11 11:37 
QuestionOnly single browser session is created Pin
Member 840431916-Nov-11 5:16
memberMember 840431916-Nov-11 5:16 
QuestionRunning Selenium HTML (Selenese) Test Cases in Parallel Pin
Member 830905511-Oct-11 8:10
memberMember 830905511-Oct-11 8:10 
QuestionBrilliant, Pin
just_do_it_5728-Sep-11 4:39
memberjust_do_it_5728-Sep-11 4:39 
GeneralMy vote of 1 Pin
santoshnagp99914-Dec-09 2:56
membersantoshnagp99914-Dec-09 2:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170713.1 | Last Updated 1 Dec 2009
Article Copyright 2009 by Obaid Malik
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid