Skip to main content

Custom VuC Functions: html_from_vu

Richard Leeke, Architecture consultant, Equinox Ltd.
Richard Leeke is one of the founding partners of Equinox Ltd., a software architecture consulting company based in Wellington, New Zealand. Richard specializes in the areas of performance testing and the diagnosis and resolution of application, database, and infrastructure related performance issues. He's a fairly regular contributor (of both questions and answers) to various performance testing related forums and can be contacted by e-mail.

Summary:  Download this utility that parses a recorded VU HTTP script to reconstruct all of the HTML pages that were recorded, as a set of individual files. It allows direct comparison with the pages returned during playback of the script in order to track down playback issues.

Date:  23 Jun 2004
Level:  Introductory
Activity:  185 views
Comments:  

Editor's note: This article is part of a library of custom VuC functions developed by performance test engineers to handle special situations encountered in scripting applications. For an overview of the library and links to other custom functions, see "A Library of Custom VuC Functions."

The html_from_vu utility parses a recorded VU HTTP script to reconstruct all of the HTML pages that were recorded, as a set of individual files. This allows direct comparison with the pages returned during playback of the script (which can be generated from the command data report with the companion utility, html_from_cmd_data ) in order to track down playback issues.

Purpose/Use

The utility was originally written to help track down the cause of an obscure problem that was making script playback fail, by comparing the HTML pages returned when the script was originally recorded with those returned at playback time. This approach allows the recording-time and playback-time versions of all HTML pages visited in a set of scripts to be compared quickly using a file comparison utility such as WinDiff or CSDiff. This approach is described in detail in the article on html_from_cmd_data.

Unlike html_from_cmd_data, this utility normally generates files only for the actual HTML pages, not for other objects referenced from the pages (such as images), since the contents of most other object types are suppressed during VU script recording in versions of IBM® Rational® Robot since about 2002. (The utility will in fact generate other files from older scripts recorded with previous versions of Robot.)


Requirements

A Perl runtime environment is required in order to run the utility, which is a Perl script. The utility was developed using ActivePerl version 5.8.1, but it should work with any relatively recent release of Perl (version 5 or above). ActivePerl is available for free download from the ActiveState site. A Perl runtime environment is also installed automatically as part of the installation of various other products, including some of the Rational suites. Alternatively, Perl is generally available on any Unix or Linux platform.

Note that in order for the utility to work, the VU script must be recorded with the option to include details of page content.


Utility Code

The utility code is contained in the file html_from_vu.pl, supplied in a ZIP file that can be downloaded. To install the utility, place the Perl script in a directory that's on the path so that it can be used without specifying a path name (for example, create a directory called c:\perlscripts and add that to the path).


Command Syntax

html_from_vu.pl [options] vu-dir

where vu-dir is the name of a directory containing one or more VU scripts from which to extract result data. Note that copying all test scripts executed in a given test run into a single temporary directory allows the simplest comparison with the files extracted from the command data report.

The options are as follows:

  • -help -- Displays a summary list of commands.
  • -d dir -- Specifies the root directory under which to create output files (defaults to the current working directory).
  • -a -- Instructs the utility to regenerate all file types, not just HTML. This is largely redundant in versions of Robot since about 2002, since Robot generally suppresses details of objects such as images in the VU scripts.
  • -hdr -- Creates files for HTTP response headers.

How to Use the Utility

Follow these steps to generate output files from a VU script:

  1. Ensure that during recording, the "Display recorded rows" option is set to "All." This will cause the HTML pages to be included in the recorded script, inside a #if 0 block, like this:
    #if 0
      "<html>\r\n"
      "<head>\r\n"
      "<title>Equinox Ltd: New Zealand Software Architects</title>\r\n"
    
    #endif

  2. Use Windows Explorer to locate the required test scripts in the repository and copy the files to a temporary directory (it's generally better to work in a separate location, rather than creating files in the repository). The scripts will be found as files with an extension of .s in the test scripts directory: "..\TestDatastore\DefaultTestScriptDatastore\TMS_Scripts#"
  3. Start a command prompt and change directory to the location of the copies of the scripts.
  4. Invoke the Perl script, specifying whatever options you require. For example, if the current directory contained three scripts -- Script_A, Script_B, and Script_C -- you would enter the following command:

    C:\Temp\vu_scripts>html_from_vu.pl . <<Note the period at the end.>>

The name of each VU script processed is displayed:

Script_A.s
Script_B.s
Script_C.s

The generated files are stored in subdirectories named the same as each test script. The filenames of the generated files are based on the command IDs within the VU scripts. For example, the above command would generate the following structure:

C:\Temp\vu_scripts\
         \ScriptA\
         \ScriptB\
         \ScriptC\

The actual HTML files generated can be viewed by opening them in a browser. Note that the pages will display with placeholders for objects referenced with relative addresses -- which is normally the case for most page content. For example, a page from my company's Web site looks like Figure 1.

Sample page from the Equinox Ltd. Web site
Figure 1: Sample page from the Equinox Ltd. Web site
(click here to enlarge)

The article on the html_from_cmd_data utility explains the process for comparing the pages generated from the original VU script using this utility with the equivalent pages extracted from the command data report.


Caveats and Known Limitations

As mentioned, the utility was created to assist with a particular performance-testing project and has been enhanced over the course of a few subsequent assignments. It hasn't been tested thoroughly over a wide range of Web sites, so there will undoubtedly be situations that it doesn't handle. If you find it useful but there are specific cases that it doesn't cope with, feel free to contact me with the details and I'll add them to the list of things that might get addressed one day. No promises. Alternatively, enhance it for me and let me have an improved copy back.

There are a few known limitations:

  • Some files may be generated with inappropriate file extensions. The script tries to work this out based on a combination of what was requested and the content type returned -- but this isn't straightforward and I've spent far too long on it already!
  • As mentioned above, VU scripts generated by Robot versions since about 2002 suppress the contents of most object types other than HTML text, although occasionally Java class files and other objects do appear. This means that a full comparison of objects seen during recording and playback isn't possible.

About the author

Richard Leeke is one of the founding partners of Equinox Ltd., a software architecture consulting company based in Wellington, New Zealand. Richard specializes in the areas of performance testing and the diagnosis and resolution of application, database, and infrastructure related performance issues. He's a fairly regular contributor (of both questions and answers) to various performance testing related forums and can be contacted by e-mail.

Comments



Trademarks  |  My developerWorks terms and conditions

Help: Update or add to My dW interests

What's this?

This little timesaver lets you update your My developerWorks profile with just one click! The general subject of this content (AIX and UNIX, Information Management, Lotus, Rational, Tivoli, WebSphere, Java, Linux, Open source, SOA and Web services, Web development, or XML) will be added to the interests section of your profile, if it's not there already. You only need to be logged in to My developerWorks.

And what's the point of adding your interests to your profile? That's how you find other users with the same interests as yours, and see what they're reading and contributing to the community. Your interests also help us recommend relevant developerWorks content to you.

View your My developerWorks profile

Return from help

Help: Remove from My dW interests

What's this?

Removing this interest does not alter your profile, but rather removes this piece of content from a list of all content for which you've indicated interest. In a future enhancement to My developerWorks, you'll be able to see a record of that content.

View your My developerWorks profile

Return from help

static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Rational
ArticleID=5106
ArticleTitle=Custom VuC Functions: html_from_vu
publish-date=06232004
author1-email=richard.leeke@equinox.co.nz
author1-email-cc=

My developerWorks community

Tags

Help
Use the search field to find all types of content in My developerWorks with that tag.

Use the slider bar to see more or fewer tags.

Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere).

My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Use the search field to find all types of content in My developerWorks with that tag. Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere). My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Rate a product. Write a review.

Special offers