Selenium and PushToTest How To Guide
PushToTest supports Selenium in the following ways. See the TestMaker 5 example_agents/AjaxTests for examples.
| Task | Steps |
| Run Selenium tests of Ajax applications in Selenium IDE, RC, Grid | Download Selenium IDE from OpenQA.org, install in Firefox, Export to Java, PHP, Perl or other supported language. |
| Run Selenium tests in a TestNode using HtmlUnit browser | In a TestScenario define: <run name="MyTest" testclass="BrewBizAjaxTest.selenium" method="selenium" langtype="selenium"/> |
| Transform Selenium tests into Script-Driven Tests and Run in a TestNode | Use TestMaker Tools drop-down menu, Transformer command. |
| Run Data-Driven Selenium Tests in Selenium IDE | Download Selenium IDE from OpenQA.org, install in Firefox |
| Run Data-Driven Selenium Tests in a TestNode | In a TestScenario define: Use a HashDPL to access Comma Separated Value (CSV) data: <DataSources> <dpl name="mydpl" type="HashDPL"> <argument name="file" dpl="rsc" value="getDataByIndex" index="0"/> </dpl> </DataSources> Identify the CSV file and Selenese test file: <resources> <data path="data.csv"/> <testgen4web path="BrewBizWeb.selenium"/> </resources>Run the Selenium test: <run name="MyTest" testclass="BrewBizAjaxTest.selenium" method="selenium" langtype="selenium"/> <argument dpl="mydpl" name="DPL_Properties" value="getData"/> </run> |
PushToTest Architecture for Selenium Support
PushToTest TestMaker operates Web application and Ajax tests as load and performance tests by running the tests in a TestNode. The TestNode operates the test using HTMLUnit. HTMLUnit is an open-source framework that provides a programmatic simulation of a Web browser. HTMLUnit uses Rhino, the Mozilla JavaScript engine, to run JavaScript and Ajax programs. This approach makes it easy to run hundreds to thousands of simulated users in a load and performance test. The alternative would be to run the test by instantiating a browser for each simulated user.
The following charts illustrates the three types of testing that PushToTest provides for Web application tests specifically.

Type 1 is for functional testing of a Web or Ajax application. PushToTest provides Selenium as a plug-in to Firefox. Selenium provides record/playback capability through the browser. Selenium drives the browser as a user would: clicking buttons, filling-in Web forms, and asserting incorrect responses from the server. This works great! It is interactive and shows issues with the test and Web application immediately.
PushToTest provides Selenium IDE as an add-on to the Firefox browser. Selenium IDE records tests, provides a test script editor, offers autocomplete for the Selenese command language, offers debugging features such as breakpoints, features logging functions, and includes on-line help.

Selenium IDE records user interaction with the Web application into a Selenese test file. Selenese is domain specific language for testing. For instance, the first command in the test shown above opens the BrewBizWeb example application and loads the sign-in page.
Once you create a test using Selenium IDE the test runs in the PushToTest TestMaker distributed test environment as a functional test, load and performance test, and business service monitor.
What About Microsoft Internet Explorer? Selenium is a plug-in for Firefox. The tests you author in Firefox operate in MS IE, and Opera, and Safari, or in the TestNode environment using HTMLUnit/Rhino.
Type 2 is for functional testing across multiple browsers. This testing checks to see how Microsoft Internet Explorer (IE,) Opera, Safari, and other browsers operate the application. PushToTest operates the Selenese test in a grid of TestNode enabled machines using the Selenium RC system. PushToTest installs TestNode and Selenium RC onto a machine and remotely operates the recorded test using the browser installed on the TestNode machine.
Type 3 is for functional testing from remote locations, load and performance testing, and business service monitoring. The TestNode operates the Selenese test remotely using HTMLUnit and Rhino. A simple TestScenario document orchestratrates which nodes will run the test and how many concurrently running simulated users operate the test.
As a functional test, the TestNode operates the test once and reports the results.

PushToTest TestMaker shows the success/failure and duration for each step within the test for functional tests. For load and performance tests the TestNode operates the test in sets of concurrently running simulated users. PushToTest summarizes the results into a Scalability Index.

For service monitoring the TestNode operates the test periodically. PushToTest shows a dashboard for each monitor.

HTMLUnit and Rhino do an adequate job of acting as a browser. There will be gaps between HTMLUnit and Rhino and the actual browser implementation. HTMLUnit and Rhino emulate most of the browser functions but not all functions. For example, each browser implements its own JavaScript engine, HTML DOM rendering engine, Security, and browser features. Many times testers will need to use a DOM, HTML, and JavaScript debugging tool such as Firebug and a network protocol analyzer (such as the Network Monitor in TestMaker or Wireshark/Ethereal) to debug the Selenese test and configure HTMLUnit to operate the test. PushToTest does a good job at providing debugging tools, trace functions, and scripting workarounds to solve these gaps and operate your Selenium test in the PushToTest environment. Additionally, PushToTest Global Services provides Ajax test experts to help you with test development.
The TestNode running a test in HTMLUnit and Rhino is a different environment from Firefox.
PushToTest provides the Data Production Library framework to provide tests with operational test data at test runtime. You will need an operational data strategy to identify the test data your test needs and how to identify and locate the data.
By understanding the PushToTest reuse methodology your organization and your team efforts will be understood, compelling, and supported. And, your test project will succeed.
Selenium Team
Selenium has its origins at ThoughtWorks.
Paul Hammant, paul at hammant.org, Architecture and Business Manager
Jason Huggins, hugs at google.com, Principal Maintainer
Jennifer Bevan, jbevan at google.com,
Simon Stewart, WebDriver project architect,
Patrick Lightbody, plightbo at gmail.com
Selenium Knowledge
Selenium Home Page
Selenium Grid/RC Home Page
Selenium and Castle for Functional Test Construction
Selenium at PushToTest
XPath Tutorial
Keith Sterling's Selenium API Guide
Downloads
Selenium IDE for Firefox
PushToTest Runtime Extensions for Selenium Testing Organizations (Presto)

