5,542,300 members and growing! (17,526 online)
Email Password   helpLost your password?
Web Development » Applications & Tools » Tools with source code     Intermediate

WebReplay - an automated software testing tool for Web applications

By Emmanuel Kartmann

This article presents an automated software testing tool for Web applications (Internet/Intranet) based on Internet Explorer.
VC7, C++, HTMLWindows, Win2K, WinXP, MFC, VS.NET2002, IE 6.0, IE 5.5, Visual Studio, IE, Dev

Posted: 16 Jun 2005
Updated: 16 Jun 2005
Views: 37,489
Bookmarked: 31 times
Announcements
Want a new Job?



Search    
Advanced Search
Sitemap
7 votes for this Article.
Popularity: 3.73 Rating: 4.41 out of 5
0 votes, 0.0%
1
0 votes, 0.0%
2
0 votes, 0.0%
3
3 votes, 42.9%
4
4 votes, 57.1%
5

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


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!

Occupation: Web Developer
Location: France France

Other popular Applications & Tools articles:

Article Top
Sign Up to vote for this article
You must Sign In to use this message board.
FAQ FAQ Noise ToleranceSearch Search Messages 
 Layout  Per page   
 Msgs 1 to 25 of 27 (Total in Forum: 27) (Refresh)FirstPrevNext
Subject  Author Date 
GeneralCheck out this WebReplay...memberJackNynguen14:01 10 Apr '08  
Generalnavigate - errormembergrandmasta11:14 16 Nov '07  
GeneralInCisif.net - Web Testing With C# or VB.NETmemberftorres18:17 1 Feb '07  
Generaldialog boxessussAnonymous11:19 20 Jul '05  
GeneralRe: dialog boxesmemberEmmanuel Kartmann23:32 16 Aug '05  
GeneralAutomatically retreving the fieldsmemberTrappedVector4:21 24 Jun '05  
GeneralRe: Automatically retreving the fieldsmemberEmmanuel Kartmann23:47 25 Jun '05  
GeneralRe: Automatically retreving the fieldsmemberEmmanuel Kartmann23:35 16 Aug '05  
Generalselect optionmembervoltek6014:06 23 Jun '05  
GeneralRe: select optionmemberEmmanuel Kartmann21:06 23 Jun '05  
GeneralRe: select optionmembervoltek6021:58 23 Jun '05  
Generalsome wrong in this application where i build it.memberwinart16:53 21 Jun '05  
GeneralRe: some wrong in this application where i build it.memberEmmanuel Kartmann20:32 21 Jun '05  
GeneralRe: some wrong in this application where i build it.memberwinart0:13 22 Jun '05  
GeneralRe: some wrong in this application where i build it.memberEmmanuel Kartmann21:09 22 Jun '05  
GeneralLook at SWExplorerAutomationmemberAlex Furman11:44 17 Jun '05  
GeneralRe: Look at SWExplorerAutomationmemberEmmanuel Kartmann3:53 20 Jun '05  
GeneralRe: Look at SWExplorerAutomationmemberAlex Furman7:07 20 Jun '05  
GeneralRe: Look at SWExplorerAutomationmemberEmmanuel Kartmann6:22 23 Jun '05  
GeneralIs that possible to use on Win CE?memberPaul_Lai23:26 16 Jun '05  
GeneralRe: Is that possible to use on Win CE?memberEmmanuel Kartmann23:51 16 Jun '05  
GeneralMissing filememberTodd Smith13:13 16 Jun '05  
GeneralRe: Missing filememberEmmanuel Kartmann21:41 16 Jun '05  
GeneralVery nice!membernetclectic6:07 16 Jun '05  
GeneralRe: Very nice!memberEmmanuel Kartmann6:22 16 Jun '05  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 16 Jun 2005
Editor: Sumalatha K.R.
Copyright 2005 by Emmanuel Kartmann
Everything else Copyright © CodeProject, 1999-2008
Web16 | Advertise on the Code Project