NAME
TestGen4Web::Runner - A PERL module to replay files recorded with
TestGen4Web
SYNOPSIS
require TestGen4Web::Runner;
my $runner = new TestGen4Web::Runner;
$runner->load('actions.xml');
if (!$runner->run())
{
print $runner->error() . "\n";
}
DESCRIPTION
TestGen4Web::Runner is a PERL module to replay files recorded with
SpikeSource's TestGen4Web Recorder.
From http://developer.spikesource.com/projects/testgen4web :
"TestGen4Web is written to ease the pain of writing tests for web
applications. This is a 2 part tool. Firefox extension, which records
user input to a xml file. Translator script: to generate automated test
scripts."
This module fits in neither the 'recorder' or 'translator' category,
instead directly replaying the XML files as generated by the TestGen4Web
recorder. This leaves the implementation of the tests to the PERL
developer utilizing this module.
This release of the module implements a subset of TestGen4Web's
features. The entire feature set will be implemented in a future
release.
Another use for this module is to interact and automate with web
services only available via HTTP and HTML (commonly called 'screen
scraping'). The desired action is recorded in the browser with the
TestGen4Web recorder and the resulting XML can be replayed by this
module in order to duplicate that action and, for example, retrieve some
text.
A working example of this module can be found in the WWW::SMS::IE::iesms
module.
The following methods are available:
$runner = new TestGen4Web::Runner
This is the object constructor. It takes no arguments.
$runner->load($filename)
Load an action XML file.
Returns true on success, false on failure; errors are in "error()".
$carrier->run($start_step, $end_step)
Replays the action file that was loaded with "load()".
The optional $start_step and $end_step arguments determine what
action steps the Runner will start and end with respectively.
Returns true on success, false on failure; errors are in "error()",
matches are in "matches()".
$runner->result()
Set/retrieve the result of the previous "run()" operation. True on
success, false on failure.
$runner->matches()
Retrieves the array of matches from the last assertion action during
a "run()".
The value part of a "assert-text-exists" action may be a regular
expression. Matches in parentheses are returned by this method.
$runner->error()
Retrieve the error message of a failed "run()".
$runner->set_replacement($key, $val)
Replace all instances of "{$key}" with $val when filling forms or
(or waiting) in the action file.
$runner->clear_replacements()
Clear all replacements.
$runner->verify_titles()
Set/retrieve the "verify_titles" setting. If true (the default),
then all "verify-title" assertions will be checked, otherwise, these
assertions will be ignored.
$runner->start_step()
Set/retrieve the first action step that will be executed by the
"run()" method.
$runner->end_step()
Set/retrieve the final action step that will be executed by the
"run()" method.
$runner->user_agent()
Set/retrieve the "LWP::UserAgent" object used internally by the
Runner.
$runner->cookie_jar()
Set/retrieve the full filename of the cookie jar as used internally
by the "LWP::UserAgent" performing the actions.
$runner->action_state()
Retrieve the state of the Runner between "run()" requests. The
returned object is of the type "HTTP::Response".
$runner->quiet()
Set/retrieve the "quiet()" setting. If this is disabled (the
default), normal output will be printed. If set to true, normal
output will be suppressed.
$runner->debug()
Set/retrieve the "debug mode" setting. If this is set to a value
greater than 0, debug output will be printed during "load()" and
"run()" operations. Greater values mean more debug output. The
default is 0.
DISCLAIMER
The author accepts no responsibility nor liability for your use of this
software.
SEE ALSO
WWW::SMS::IE::iesms,
AUTHOR
David McNamara (me.at.mackers.dot.com)
COPYRIGHT
Copyright 2000-2006 David McNamara
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.