4 min read

Selenium 1.0 Testing Tools: Beginner’s Guide

Important preliminary points

To complete the examples of this article you will need to make sure that you have at least Java JRE installed. You can download it from http://java.sun.com. Selenium Remote Control has been written in Java to allow it to be cross platform, so we can test on Mac, Linux, and Windows.

What is Selenium Remote Control

Selenium IDE only works with Firefox so we have only been checking a small subsection of the browsers that our users prefer. We, as web developers and testers, know that unfortunately our users do not just use one browser. Some may use Internet Explorer, others may use Mozilla Firefox. This is not to mention the growth of browsers such as Google Chrome and Opera.

Selenium Remote Control was initially developed by Patrick Lightbody as a way to test all of these different web browsers without having to install Selenium Core on the web server. It was developed to act as a proxy between the application under test and the test scripts. Selenium Core is bundled with Selenium Remote Control instead of being installed on the server.

This change to the way that Selenium tests are run allowed developers to interact with the proxy directly giving developers and testers a chance to use one of the most prominent programming languages to send commands to the browser.

Java and C# have been the main languages used by developers to create Selenium Tests. This is due to most web applications being created in one of those languages. We have seen language bindings for dynamic languages being created and supported as more developers move their web applications to those languages. Ruby and Python are the most popular languages that people are moving to.

Using programming languages to write your tests instead of using the HTML-style tests with Selenium IDE allows you, as a developer or tester, to make your tests more robust and take advantage of all setups and tear down those that are common in most testing frameworks.

Now that we understand how Selenium Remote Control works, let us have a look at setting it up.

Setting up Selenium Remote Control

Selenium Remote Control is required on all machines that will be used to run tests. It is good practice to limit the number of Selenium Remote Control instances to one per CPU core. This is due to the fact that web applications are becoming more “chatty” since we use more AJAX in them. Limiting the Selenium instances to one per core makes sure that the browsers load cleanly and Selenium will run as quickly as possible.

Time for action – setting up Selenium Remote Control

  1. Download Selenium Remote Control from http://seleniumhq.org/download.
  2. Extract the ZIP file.
  3. Start a Command Prompt or a console window and navigate to where the ZIP file was extracted.
  4. Run the command java –jar selenium-server-standalone.jar and the output should appear similar to the following screenshot:

What just happened?

We have successfully set up Selenium Remote Control. This is the proxy that our tests will communicate with. It works by language bindings, sending commands through to Selenium Remote Control which it then passes through to the relevant browser. It does this by keeping track of browsers by having a unique ID attached to the browser, and each command needs to have that ID in the request.

Now that we have finished setting up Selenium Remote Control we can have a look at running our first set of tests in a number of different browsers.

Pop quiz – setting up Selenium Remote Control

  • Where can you download Selenium Remote Control from?
  • Once you have placed Selenium Remote Control somewhere accessible, how do you start Selenium Remote Control?

Running Selenium IDE tests with Selenium Remote Control

The Selenium IDE to create all the tests have only been tested on applications in Firefox. This means the testing coverage that you are offering is very limited. Users will use a number of different browsers to interact with your application. Browser and operating system combinations can mean that a developer or tester will have to run your tests more than nine times. This is to make sure that you cover all the popular browser and operating system combinations.

Now let’s have a look at running the IDE tests with Selenium Remote Control.

LEAVE A REPLY

Please enter your comment!
Please enter your name here