Click here to Skip to main content
Click here to Skip to main content

WebReplay - an automated software testing tool for Web applications

By , 16 Jun 2005
 

Click to enlarge

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:

<?xml version="1.0" encoding="Windows-1252"?>
<web_replay>
  <scenario>
    <!-- Search something in codeproject -->
    <!-- Scenarios are divided into steps (one step per page download) -->
    <step>
      <!-- Every step can contain one or more actions -->
      <!-- Action can be of type "navigate" = 
             Web Replay will navigate to the given URL -->
      <action type="navigate" url="http://www.codeproject.com" />
    </step>
    <step>
      <!-- Action can be of type "control" = 
             Web Replay will interact with an HTML element -->
      <action type="control" 
             name="target" event="set_value" value="WebReplay" />
      <!-- This field is unnamed; but it has a specific value attribute -->
      <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) $

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Emmanuel Kartmann
Web Developer
France France
Member
Fell into computer software at the age of 11, founder of 3 startups, and now manager of an independent software vendor (ISV) labelled proSDK (www.prosdk.com)... And still a freeware writer and technical article author!

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
GeneralnicememberDonsw22 May '09 - 7:46 
Nice but no recording for replay.
You should update this with more features. Good potential
 
cheers,
Donsw
My Recent Article : Backup of Data files - Full and Incremental

GeneralCheck out this WebReplay...memberJackNynguen10 Apr '08 - 13:01 
A really nice (and free) IE-Addon also called WebReplay to automate web applications:
http://www.iewatch.com/downloadwr.aspx
Generalnavigate - errormembergrandmasta116 Nov '07 - 0:14 
why i can't load some urls???
 
e.g. ".../index.php?p=search"
 
i found no solution for this problem...
GeneralInCisif.net - Web Testing With C# or VB.NETmemberftorres1 Feb '07 - 17:17 
InCisif.net is an automation tool designed to implement client-side functional
testing of web applications under Internet Explorer 6.x or 7.x, using the C#
or VB.NET language with Visual Studio 2003, 2005 or express editions.
 
Version 1.2 New features:
 
- An interactive DOM viewer available at record time Big Grin | :-D
- NUnit support (source code available) Laugh | :laugh:
- TestDriven.net add-in support (source code available) Wink | ;)
 
Coming features version 1.3 March 2007:
 
- More methods to support AJAX applications Roll eyes | :rolleyes:
- IronPython support WTF | :WTF:
- Test/suite reporting api. Suspicious | :suss:
 
http://www.incisif.net

Generaldialog boxessussAnonymous20 Jul '05 - 10:19 
Is it possible to automatically select certain buttons on dialog boxes that a web site initiates and/or that the web browser initiates (e.g. for a web site --- "click Yes to indicate you agree to the terms and conditions", and for a web browser --- "you are being redirected, is this ok?")
 
The latter issue isn't so bad since those can be tweaked in the registry, but the former problem I have no idea how to address. What do you think? Thanks.
GeneralRe: dialog boxesmemberEmmanuel Kartmann16 Aug '05 - 22:32 
For automated testing (not browsing external Web Sites), Web Replay 2 (a complete rewrite implemented 100% in Javascript) can support some dialog boxes (alert and confirm); maybe it can address your needs:
 
http://www.codeproject.com/useritems/WebReplay2.asp[^]
GeneralAutomatically retreving the fieldsmemberTrappedVector24 Jun '05 - 3:21 
Hi,
instead of examining the page to be tested and writing the xml file by hand, can't a html js file be created which opens in a fixed frame in the webcontrol and the test page opens in the second frame.The js page can enumerate all the input tag vlaue names and ask the user(in a HTML form) to seect the fields in which he is interested to test.Furthermore the js page can aumtaically decide to invoke click on some elements like button aumatically.
So the whole task can be divided into two phases.
Step 1 of 2:Let the prog examine the test page and ask the user's preference to select the elements and type of test.
Step 2 of 2:The actual test(which is currently in place).
 
That should not be a daunting task in javascript and will reduce user effort to minimum.
 
Regards
TrappedVector
 
I dont have a flikering mind.I always take quick decisions,the wrong ones.
GeneralRe: Automatically retreving the fieldsmemberEmmanuel Kartmann25 Jun '05 - 22:47 
I was thinking about giving up the XML file anyway.
I need (for my own Web app) to execute "external commands" anyway, so the scenario file will probably end up being a PROGRAM, and Web Replay will generate and replay this program. Scripting (javascript?) sounds appealing to me - any help/suggestion welcome at this point...
 
Regards,
 
E.

GeneralRe: Automatically retreving the fieldsmemberEmmanuel Kartmann16 Aug '05 - 22:35 
Thanks!
 
Your idea of FRAMES+Javascript has been the key to a complete rewrite of Web Replay; it can't record scenarios (yet) but is implemented 100% in Javascript (bye bye C/C++ and COM!):
 
http://www.codeproject.com/useritems/WebReplay2.asp[^]
 
I'll be working on the recording (Javascript format!) soon...
 
Best regards,
 
E.

Generalselect optionmembervoltek6023 Jun '05 - 13:06 
it is possible to use :
 

 
in order to change the html :
 
<select name="option1">
<option>100</option>
<option>101</option>
</select>

 
??

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Permalink | Advertise | Privacy | Mobile
Web01 | 2.6.130523.1 | Last Updated 16 Jun 2005
Article Copyright 2005 by Emmanuel Kartmann
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid