- Selenium-RC allows the test automation developer to use programming language for maximum flexibility and extensibility in developing test logic.
- For instance, if the application under test returns a result set, and if the automated test program needs to run tests on each element in the result set, the programming language’s iteration support can be used to iterate through the result set, calling Selenium commands to run tests on each item.
- Selenium-RC provides an API (Application Programming Interface) and library for each of its supported languages: HTML, Java, C#, Perl, PHP, Python, and Ruby.
Selenium RC components:
- Selenium Server : acts as an HTTP proxy for browser requests.
- Client libraries : for various programming languages, each of which instructs the Selenium Server in how to test the AUT by passing it your test script’s Selenium commands.
The Selenium Server, which launches and kills browsers.
Client libraries which provide the interface between each programming language and the Selenium RC Server.
• Install the Selenium RC Server.
Installing Selenium Server
The Selenium RC server is simply a Java jar file (selenium-server.jar), which doesn’t require any special installation. Just downloading the zip file and extracting the server in the desired directory is sufficient.
• Go to http://seleniumhq.org/download/.
• Under Selenium Server (formerly the Selenium RC Server) section, you can see the selenium server latest version.
• Click on download, it will be redirected to selenium server download page.
• Selenium server is a JAR file. Download selenium serverstandalone-2.ob3.jar
Create a Folder selenium in “C” drive.
Paste the selenium-server-standalone-2.ob3.jar file in that folder.
We need to be able to start and stop the Selenium Server.
We can do this at the command line:
Start: (Command line)
java -jar selenium-server-standalone-2.0b3.jar
The output should appear similar to the following screenshot.
Running Selenium IDE tests with Selenium Remote Control
Selenium IDE scripts may be run in Selenium RC by running them directly on the server with a -htmlSuite parameter.
Imagine that you have to run your Selenium IDE tests on a computer that doesn’t have Selenium IDE installed or you do not want to use Firefox with any add-ons installed. To do this, you will need to use Selenium Remote Control.
Getting Started with Selenium/ Selenium RC steps
1. Record your test case using Selenium IDE
2. Play your test case using selenium IDE, it to make sure that your test case works.
3. Export your recording test case – as html file.
4. Create a test suite.
STEPS TO RUN SCRIPTS USING SELENIUM RC
Execute Selenium RC via command line against Firefox, Chrome and Internet explorer.
Create a folder in any drive – Ex: C:tests
Create a folder in any drive – Ex: C:results
We need to create two folders.
1. To save our test suite and test case. (tests)
2. To save results (results)
Using Selenium IDE record a test case and save it as .html in a tests folder. Make sure your test run correctly.
Create a Test suite:
RC operates on SIDE test suite files, rather than test case files. The test suite contains the file names of the test case(s) to run. A test suite file exists in the same directory as the test case file(s).
Create a test suite and save it in C:tests folder
To run our tests in Selenium Remote Control, we will have to use the –html suite argument. This tells Selenium to open the Test Suite that we created. We then need to tell it where to find the Test Suite and then where to write the results to. Our command in Command Prompt or a console window will be similar to the following snippet:
We can run our tests in any browser by using selenium RC.
java -jar selenium-server.jar -htmlSuite “*browser”
“http://www.example.com” “target folder” “results folder“
RUN THE ABOVE COMMAND FROM COMMAND PROMPT
Run this command from selenium directory.
C:s0elenium>java -jar selenium-server.jar -htmlSuite “*iexplore”
“http://www.google.com” “c:testsrun.html“ “c:resultsresults1.html”
Below is the screenshot of TEST RUNNER
Be the first to post a reply!