QA/Execution/Web Testing/Selenium IDE RC: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 31: Line 31:
<br>  
<br>  


2. Download the Selenium-RC zip from the OpenQA.org Selenium-RC downloads page. I successfully used version 1.0.1, but 1.0 Beta-2 failed on my system.
==== Install Selenium RC ====


3. Unzip the download to a location of your choosing.  
a. Download the Selenium-RC zip from the OpenQA.org Selenium-RC downloads page.  


4. In the directory containing Selenium RC find selenium-server.jar. In version 1.0.1 it is in the subdirectory selenium-server-1.0.1.  
b. Unzip the download.  


5. If any user extensions are required (remember that the While and Goto commands come from a user extension): a. Append all needed extensions together into one file named user-extensions.js IMPORTANT: goto_sel_ide.js, which defines While and Goto commands, does not work in RC. Instead, use goto_sel08.js found on the same Selenium download page. b. Save user-extensions.js in the same subdirectory as selenium-server.jar
c. In the directory containing Selenium RC find selenium-server.jar. In version 1.0.1 it is in the subdirectory selenium-server-1.0.1.  


6. Open a Windows command line window. Navigate to the directory containing selenium-server.jar.
d. If any user extensions are required (remember that the While and Goto commands come from a user extension): a. Append all needed extensions together into one file named user-extensions.js IMPORTANT: goto_sel_ide.js, which defines While and Goto commands, does not work in RC. Instead, use goto_sel08.js found on the same Selenium download page. b. Save user-extensions.js in the same subdirectory as selenium-server.jar  


7. Enter the following at the command line, modified as necessary:  
==== Run the script  ====
 
a. Open a Windows command line window. Navigate to the directory containing selenium-server.jar.
 
b. Enter the following at the command line, modified as necessary:  


       java  
       java  
Line 72: Line 76:
-timeout The timeout parameter needs to specify, in seconds, the expected time the script will run. The default timeout is 1800 seconds (30 minutes). If the script isn't finished within the timeout period selenium-server terminates with the error HTML suite exception seen: org.openqa.selenium.server.SeleniumCommandTimedOutException  
-timeout The timeout parameter needs to specify, in seconds, the expected time the script will run. The default timeout is 1800 seconds (30 minutes). If the script isn't finished within the timeout period selenium-server terminates with the error HTML suite exception seen: org.openqa.selenium.server.SeleniumCommandTimedOutException  


<br> Limitation observed  
==== <br> Limitation observed ====


Echo output is shifted within the log file Echo statement output is shifted forward to the next call of the same statement. The script listing at the top of the results lists the last echo output. For example: The first execution of the "echo | ${myVar}" lists no output. The second execution of the same statement lists the output of the first execution. The output of last execution appears in the top of the log in the script listing. "echo | ${myVar2}" output is shifted forward each time it is executed. The shortcoming is minor in a linear script or echos within a loop. Analyzing the output log can become difficult when reviewing echos in different "contexts" such as inside and outside of a while loop, or selected echos executed conditionally when others are not.
Echo output is shifted within the log file Echo statement output is shifted forward to the next call of the same statement. The script listing at the top of the results lists the last echo output. For example: The first execution of the "echo | ${myVar}" lists no output. The second execution of the same statement lists the output of the first execution. The output of last execution appears in the top of the log in the script listing. "echo | ${myVar2}" output is shifted forward each time it is executed. The shortcoming is minor in a linear script or echos within a loop. Analyzing the output log can become difficult when reviewing echos in different "contexts" such as inside and outside of a while loop, or selected echos executed conditionally when others are not.

Revision as of 23:34, 27 January 2010

The page is still under construction. But should be finished soon.



Selenium IDE scripts may be run by Selenium Remote Control by using the -htmlSuite parameter. The link to official Selenium documentation is here.

These notes are based on Selenium RC 1.0.1.


1. Create the test suite.

RC uses a SIDE test suite, rather than a test case.  The test suite contains the file names of the test case(s) to run.  It exists in the same directory as the test case file(s).

To create a test suite file

a. Create an empty test suite file as follows: In SIDE select File > New Test Suite. Select Save Test Suite As and save the file with an html extension in the same directory as the test case(s).

b. In a text editor open the test suite file and find the line <tr><td><a href="../../..">Untitled</a></td></tr>.  Copy the line for each test case the suite will run.

c. Replace ../.. in the href with the test case file name.  The directory name can be omitted or be ./ (dot slash) since the test case and suite are in the same directory.

d. Change the text from "Untitled" to the test case title.

e. Above the test cases find the line <tr><td><b>Test Suite</b></td></tr> and replace "Test Suite" with an appropriate test suite title.

f. Confirm the test suite file works by running it in SIDE: File > Open Test Suite.  Run the entire test suite using the run icon with three dark green bars.

( If there is a an easier way to create the full test suite from IDE we should document those instructions. )


Install Selenium RC

a. Download the Selenium-RC zip from the OpenQA.org Selenium-RC downloads page.

b. Unzip the download.

c. In the directory containing Selenium RC find selenium-server.jar. In version 1.0.1 it is in the subdirectory selenium-server-1.0.1.

d. If any user extensions are required (remember that the While and Goto commands come from a user extension): a. Append all needed extensions together into one file named user-extensions.js IMPORTANT: goto_sel_ide.js, which defines While and Goto commands, does not work in RC. Instead, use goto_sel08.js found on the same Selenium download page. b. Save user-extensions.js in the same subdirectory as selenium-server.jar

Run the script

a. Open a Windows command line window. Navigate to the directory containing selenium-server.jar.

b. Enter the following at the command line, modified as necessary:

     java 
        -jar selenium-server.jar 
        -userExtensions user-extensions.js
        -htmlSuite 
           "*chrome" 
           "<base URL>" 
           "<absolute path of the Selenium test suite>" 
           "<absolute path of the results log>"

-timeout nnnn

Notes:

In actuality the command is entered as one continuous line. It is written with multiple lines for readability.

-userExetensions A simple script without user extensions does not need "-userExtensions user-extensions.js".

-htmlSuite Help can be displayed for the -htmlSuite parameter by using it without arguments: java -jar selenium-server.jar -htmlSuite

  • chrome specifies Firefox as the browser to run the tests against, or *iehta specifies Internet Explorer as the browser. (These values are for RC 1.0.1. The values in 1.0.Beta 2 are *firefox and *iexplore)

The <base URL> argument is required, whether or not it's needed by the script. For example: https://addons.mozilla.org, or http://www.ebay.com

The results log is created in an html format, and the path should have an html extension. The first part of the log lists the script The second part of the log lists the execution and echo lines displayed in the bottom half of the SIDE window during runtime.

Once the script finishes RC immediately creates the first part of the log file. The second part off the log is created after a very long delay.

-timeout The timeout parameter needs to specify, in seconds, the expected time the script will run. The default timeout is 1800 seconds (30 minutes). If the script isn't finished within the timeout period selenium-server terminates with the error HTML suite exception seen: org.openqa.selenium.server.SeleniumCommandTimedOutException


Limitation observed

Echo output is shifted within the log file Echo statement output is shifted forward to the next call of the same statement. The script listing at the top of the results lists the last echo output. For example: The first execution of the "echo | ${myVar}" lists no output. The second execution of the same statement lists the output of the first execution. The output of last execution appears in the top of the log in the script listing. "echo | ${myVar2}" output is shifted forward each time it is executed. The shortcoming is minor in a linear script or echos within a loop. Analyzing the output log can become difficult when reviewing echos in different "contexts" such as inside and outside of a while loop, or selected echos executed conditionally when others are not.