Introduction
Web Replay is an automated software testing tool for Web applications. It helps in detecting bugs and regressions in Web applications by replaying scenarios to test the application.
Using WebReplay, you can automatically navigate to a Web page, fill in form fields, click on the submit (OK) button, and then continue to another Web page.
To use Web Replay, build an XML Scenario File (see below), type the name of the file in the edit box and click on the Replay button.
Background (optional)
Web Replay is based on Microsoft's WebBrowser control (Microsoft� ActiveX� control). It embeds the control into a very simple dialog-based application which loads an XML scenario file and programmatically drives the WebBrowser control (via its COM Interface IWebBrowser2) to execute the scenario.
Using the code
Web Replay provides the following features:
- Replay scenarios from an XML file.
- Supports every feature supported by Microsoft Internet Explorer (includes Windows Integrated Authentication).
- Supports HTML forms, HTML input elements, HTML hyperlinks (anchors).
- Supports two actions on HTML elements:
set_value
and click
:
set_value
simulates a change in the HTML element's value (input
, select
, etc...).
click
simulates a mouse click on the HTML element (any element).
- Supports unnamed HTML elements: Elements can be found with their associated value and/or
innerText
and/or Href
.
- Stores and reloads the last scenario file name (it uses a good old WebReplay.ini file).
- Supports dynamically-generated Web Sites (client-side): If your web site generates HTML within the browser (using JavaScript's commands like "document.write"), Web Replay can still play back a given scenario - it uses a timeout mechanism to find the dynamically-generated controls.
Sample XML Scenario
An XML scenario file looks like this:
="1.0" ="Windows-1252"
<web_replay>
<scenario>
-->
-->
<step>
-->
-->
<action type="navigate" url="http://www.codeproject.com" />
</step>
<step>
-->
<action type="control"
name="target" event="set_value" value="WebReplay" />
-->
<action type="control" name="" value="Go" event="click" />
</step>
</scenario>
</web_replay>
To build a scenario file, you need to basically know the names (or ids) of HTML elements within your Web Application. Alternatively, you can use an empty name and use the HTML element's value (for unnamed items).
Points of Interest
How do you test code? Well, just write a test program! Web Replay helps you with this by providing a simple way of testing you Web apps. But it's still a brand new program; the TODO list is long...
Web Replay TODO List
- Play scenarios multiple times (even infinite loops to stress-test your Web application).
- Use of variables/expression in scenario files (to replay scenarios that are always different).
- Batch playback of scenario files.
- Enhanced error detection (e.g. a scenario should fail if a given HTML pattern is not found in the HTML page).
- Automated recording of scenario files (implement an event sink for IWebBrowser2 and record HTML elements names/id and associated event).
History
V1.0 - $Date: 2005-06-16 11:50:08 +0200 (Thu, 16 Jun 2005) $