User    Pass    

















Running Selenium tests from the command line on Windows 7 can be slightly challenging simply due to the permissions system. By default Windows 7 tends to be locked down and there is conflicting information out there on exactly what steps to take to get Selenium tests running. The intention is that this article will provide some help for people trying to run Selenium Test Suites from the command line on Windows 7 (and other Windows versions).

1) Create a Selenium HTML test

Create a simple Selenium test (or ten) to add to your test suite. Creating a Selenium test is easy in LiquidTest. See our LiquidTest documentation on ”how to record Selenium HTML tests”.

2) Create a Selenium Test Suite

Because HTML is essentially a content formatting language it contains little scope to tell any executing program exactly what to do outside of basic presentation. With this in mind and given that Selenium supports the HTML test format, the Selenium team came up with Selenium Test Suites to tell the Selenium runner (Selenium RC/Server) what tests to execute and the order of execution. Selenium Test Suites are fairly straight forward. In their simplest form they contain an HTML Table (TABLE), with a Row (TR) and some Table Data (TD).

		<title>My Application Test Suite</title>
			<tr><td><b>Suite Of Tests</b></td></tr> 
			<tr><td><a href="./Test1.html">Test Example</a></td></tr>

Notice that the tests can be grouped with the first Table Row, and then the preceding rows link to the actual test cases. This formatting helps with both execution ordering of test cases and to attach meaningful data to the results file output by the Selenium RC/Server.

3) Executing Selenium Test Suites from the Command Line

Security and Internet Explorer: Due to Windows 7 security, running tests as anything but Administrator produces sketchy results at best. I had numerous problems with Internet Explorer. Firstly Internet Explorer was loading Selenium RC/Server with many script errors regardless of configuration. The tests never replayed in this state. Firefox fared better in that it ran and produced the necessary results file. To avoid security issues with Selenium RC/Server ensure that any tests you are executing from the Command Line are through an Administrator Command Prompt (right-click on the Command Prompt and select “Run as Administrator”.

Administrator command line

Creating a Windows Batch file to run your Selenium Test Suite To make life a little easier we will create a simple batch file to save writing the command out by hand for each Selenium Test Suite execution. The batch file consists of Java's JAR command (ensure Java is in your System PATH or use the full file location to your Java bin directory). We specify to Selenium RC/Server that we wish to run a Test Suite, targeting Internet Explorer with a default URL of google.com (for our test) and then we specify where our Selenium Test Suite is located, where we want our Results file written and finally the Port for executing the communication.

java -jar selenium-server-standalone-2.0b3.jar -htmlSuite "*iexplore" "http://www.google.com" "D:\selenium-2\TestSuite.html" "D:\selenium-2\results.html" -port 4445

The action.. When running a Selenium Test Suite, the browser you're targeting will open and the test will replay.

Selenium Server / RC running on the command line

Selenium Server running test

4) Selenium test execution Results File

Selenium will start up and execute the Test Suite and write a Results file to the location you specified. The Results file looks like the following:

Selenium Server / RC - Test execution resultsSelenium individual test details

Hopefully this example will be enough to get you started with running your Selenium HTML tests from the command line. For information on how to run your Selenium JUnit tests against the Selenium Server from within the Eclipse IDE please view the tutorial here..

  • Bookmark "Running selenium tests from the command line on windows" at del.icio.us
  • Bookmark "Running selenium tests from the command line on windows" at Digg
  • Bookmark "Running selenium tests from the command line on windows" at Furl
  • Bookmark "Running selenium tests from the command line on windows" at Reddit
  • Bookmark "Running selenium tests from the command line on windows" at Google
  • Bookmark "Running selenium tests from the command line on windows" at StumbleUpon
  • Bookmark "Running selenium tests from the command line on windows" at Newsvine
  • Bookmark "Running selenium tests from the command line on windows" at DZone

   News / Events


 > LiquidTest EOL Announcement - Info
 > LiquidTest Release 3.0! - Available
 > Visual Studio Plugin Released! - Release
 > Cruise Control .NET Integration - Info
 > Automate your Dev/Test Process - Webinar
 > Is manual testing crippling your project? - Blog
 > Testing complex Ajax content - Blog
   Recently Added Content  
 > Run LiquidTest's on Selenium RC/Server - Info
 > Setting up LiquidTest with Maven - Blog
 > Officially Supported Ajax Frameworks - Info
 > Atlassian Bamboo Integration - Tech
 > Setting up LiquidTest with SVN and Hudson - Blog
 > Creating Data-Driven Functional Tests - Blog
 > Reducing Test Maintenance - Blog

 © JadeLiquid, LiquidTest and WebRenderer are trademarks of JadeLiquid, all rights reserved.  Privacy Policy  |  Disclaimer











Contact Us