Web Recorder is a set of Ruby scripts that use COM to record a web session run with Microsoft Internet Explorer, store the session information in an XML file, and play back the stored session with IE. Optionally, testpoints can be added to the XML file to compare the recorded web pages with the pages returned when the session is played back.
I wrote Web Recorder at SAS because we needed a test tool that combined the best of both web script recorders and programmatic web testing tools. The main problem with a lot of script recorders is that they don't discriminate between interesting and non-interesting features on a web page. So when you play back the script, the test tool flags a lot of changes you don't care about (such as icons that have moved a few pixels since the script was recorded). On the other hand, programmatic web testing tools involve, well, programming. You can't create a test by simply surfing your web site; you have to write a lot of code to navigate to the pages under test and look at the stuff you want to test. And most programmatic tools have their own rendering engine, which never quite renders the incoming HTML like a browser (especially IE!) renders it. By controlling IE via COM, Web Recorder lets IE's rendering engine do all the heavy lifting.
Web Recorder lets you surf your site and record the web pages, but then lets you specify exactly those parts of the pages that you want to test, and ignores the rest. And Web Recorder is designed to support a wide variety of tests, so you won't be limited to testing for an exact match between the recorded script and the played-back web page. You can add a new type of test yourself if the existing tests don't do what you want. The script file format uses XML and is (more or less) easily understandable; it has to be, because you edit the script file to add testpoints. Future plans include a GUI tool to manipulate the testpoints so manual editing won't be required.
Web Recorder has a modular architecture, so it should be possible to support other web browsers (e.g. Firefox) without too much trouble. The COM interface to Internet Explorer has been wrapped by a more generic interface; you can write a new wrapper for any browser that can be controlled programmatically and drop it in. So a script recorded using one browser can be played back on another browser, and the browser-independent parts of the web site can be tested with either browser.
You can use it to test the browser-based interface of your web applications as well as static web sites. Because Web Recorder supports various types of tests, it's good for both functional testing and for confirming that the various graphical elements haven't dropped off the screen. It can also be used as the basis for performance and stress testing by adding code to play back scripts through multiple connections simultaneously (future work).
If you don't include any testpoints in the recorded script, Web Recorder makes a dandy automation tool. Need to control a web site programmatically? Just record a script and play it back at the right time. Or use the script as a template, write another program to change it appropriately on the fly, then play back the changed script to enter any values you want on the site.
Record a web session by running the recorder. To do this, type
ie_recorderfrom the Web Recorder directory. The recorder will start and will bring up IE. Surf to your heart's content. When you're done with the web session, close IE. The recorder will save the session to a file called
Here's an example recorder script:
<recorder> <navigate> <url>http://d10567.na.sas.com/cgi-bin/regex.pl</url> <target_frame></target_frame> <post_data></post_data> <http_headers></http_headers> </navigate> <html_page> <html lang='en-US' xmlns='http://www.w3.org/1999/xhtml'> <head> <title/> </head> <body> <table width='700'> <tbody> <tr> <td>This is a Perl regular expression evaluator. To use it insert a Perl regular expression (match or substitution) in the "Regular Expression" text field and the string to apply it on in the "Apply to String" text field. Press the "Apply" button to apply the regular expression to the string; the results will be displayed in the "Result" text field. If the regular expression is a match, then the portion of the string that matched will be surrounded by doubled angle brackets (e.g. "<< >>"). If the regular expression is a substitution, then the results of the substitution will be displayed. </td> </tr> </tbody> </table> <hr/> <form action='/cgi-bin/regex.pl' method='post'> <table> <tbody> <tr> <td>Regular Expression: </td> <td> <input name='regex_str' size='100'/> </td> </tr> <tr> <td>Apply to String: </td> <td> <input name='applied_str' size='100'/> </td> </tr> <tr> <td> <input name='Apply' type='submit'/> </td> </tr> <tr> <td>Result: </td> <td> <input name='result_str' size='100'/> </td> </tr> </tbody> </table> </form> </body> </html> </html_page> <quit/> </recorder>
(Optionally) add testpoints to the recorder script. Edit the file, and add a "testpoint" attribute to the tags you want to test. The value of the attribute has the following format: testpoint name
:exact_shallow where testpoint name is a unique name for the testpoint (you pick it), the colon is a separator, and whatever follows the colon is the type of test to perform. Currently the only test that Web Recorder supports is an exact match for the tag that has the testpoint ("exact"), but not for any children of the tag ("shallow").
<td testpoint="regex_test:exact_shallow">Regular Expression: </td>
Play the script back by running
ie_playbackfrom the command line. The script will be fed to Internet Explorer and any testpoints will be tested. The results will be printed to stdout and/or stderr.
Get involved! Take this code and run with it. I'll be more than happy to give you full credit for any improvements you make, and if you want to become a team member, that's even better!
Thanks to the good folks at
for hosting Web Recorder.