Selenium RC Overview

10
Selenium RC Overview Internal architecture of RC 1

description

Selenium RC Fundamentals and Brief about the selenium internal architecture

Transcript of Selenium RC Overview

Page 1: Selenium RC Overview

Selenium RC Overview• Internal architecture of RC

1

Page 2: Selenium RC Overview

Selenium RC•

Selenium Remote Control (RC) is a test tool that allows testers to write automated Web Application User Interface tests in many programming languages against any HTTP website using any mainstream JavaScript-enabled browser.

• Selenium RC comes in two parts. • A server which automatically launches and

kills browsers, and acts as a HTTP proxy for web requests from them.

• Client libraries for computer languages. 2

Page 3: Selenium RC Overview

Selenium RC Architecture

3

Selenium RC Server

Your Test Suiteswritten in any

supported programming

language

Point to any supported browser

Page 4: Selenium RC Overview

Platforms Supported by Selenium RC• Browsers• Firefox, IE, Safari and Opera

• Operating Systems• Windows, OS X, Linux, and Solaris

• Programming Languages• C#, Java, Perl, PHP, Python, and Ruby

• Testing Frameworks• Bromine, JUnit & TenstNG (Java), NUnit (.Net),

RSpec & Test::Unit (Ruby), unittest (Python)4

Page 5: Selenium RC Overview

Selenium RC • The Selenium RC Server is used for testing complex AJAX-

based web user interfaces under a Continuous Integration system.

• Selenium RC is used with Selenium Core/Selenium IDE to write tests in programming languages other than the Selenese HTML table format.

• The RC server is bundled with Selenium Core and automatically loads it into the browser.

• Without using special modes, using Selenium RC test script, one cannot test domain changing web applications or within the same domain to change from insecure (http) page to secure (https) page. 5

Page 6: Selenium RC Overview

RC Command Line OptionsUsage: java -jar selenium-server.jar [-interactive] [-options] • port <nnnn>:(default 4444) • the port number the selenium server should use

• timeout <nnnn>: (eg: 180)• an integer number of seconds

• interactive: • Interactively enter the commands.

• multiWindow: • Tests are executed in a separate window and supports web pages

with frames.• forcedBrowserMode <browser>: (eg: *iehta)• sets the forced default browser mode (e.g. "*iexplore“) for all

sessions, no matter what is passed in getNewBrowserSession 6

Page 7: Selenium RC Overview

RC Command Line Options• User Extensions <file>: • indicates a JavaScript file that will be loaded into selenium

• Browser Session Reuse: • stops re-initialization and spawning of the browser between tests

• Avoid Proxy: • Uses by default proxy for browser request• set this flag to make the browser use proxy only for URLs

containing '/selenium-server' • Firefox Profile Template <dir>: • By default generates a fresh empty Firefox profile for every test. • Provide a directory to use your profile directory instead.

7

Page 8: Selenium RC Overview

RC Command Line Options• debug: • Debug mode provides more trace information and used for

diagnostics purpose• log: • When enabled writes debug information out to a log file

• htmlSuite <browser> <startURL> <suiteFile> <resultFile>: • Provide browser and URL to run a single HTML Selenese Test

suite and then exit immediately. • Provide absolute path to the HTML test suite, and HTML results

file.• proxyInjectionMode:

• A proxy injection mode is a mode where the selenium server acts as a proxy server for all content going to the AUT. Under this mode, multiple domains can be visited.

8

Page 9: Selenium RC Overview

RC Command Line Options• The following additional flags are supported for proxy injection mode

: • Don’t Inject Regex <regex>: an optional regular expression that

proxy injection mode can use to know when to bypass injection • User Js Injection <file>: specifies a JavaScript file which will then

be injected into all pages • User Content Transformation <regex> <replacement>:

• A regular expression which is matched against all test HTML content; the second is a string which will replace matches. These flags can be used any number of times. A simple example of how this could be useful: if you add "-user Content Transformation https http" then all "https" strings in the HTML of the test application will be changed to be "http".

9

Page 10: Selenium RC Overview

RC Command Line Options• Java system properties:

• Dhttp.proxyHost and -Dhttp.proxyPort• Normally Selenium RC overrides the proxy server configuration, using the

Selenium Server as a proxy. Use these options if you need to use your own proxy together with the Selenium Server proxy.

• Use the proxy settings like this:• java -Dhttp.proxyHost=myproxy.com -Dhttp.proxyPort=1234 -jar selenium-

server.jar • HTTP proxy requires authentication, you will also need to set -Dhttp.proxyUser

and -Dhttp.proxyPassword, in addition to http.proxyHost and http.proxyPort. • java -Dhttp.proxyHost=myproxy.com -Dhttp.proxyPort=1234 -

Dhttp.proxyUser=joe -Dhttp.proxyPassword=example -jar selenium-server.jar

10