NAME

WWW::Webrobot::pod::OutputListeners - Interface for the family of output listeners

SYNOPSIS

Usage within a config file:

 output=WWW::Webrobot::Print::MakeTestplan
 output=WWW::Webrobot::Print::Text
 output=WWW::Webrobot::Print::Test
 output=WWW::Webrobot::Print::Html
 
 # Caveat: What follows "File" is really perl syntax (eval'ed)
 output=WWW::Webrobot::Print::File 'dir' => 'diff_new', 'diff_mode' => 'diff_orig'
 output=WWW::Webrobot::Print::File 'dir' => 'diff_orig'

For writing your own class please study the source of WWW::Webrobot::Print::Text or WWW::Webrobot::Print::Test.

DESCRIPTION

Output listeners are defined within a config file, see "SYNOPSIS" and WWW::Webrobot::pod::Config. They are called in sequence if you instantiate more than one listener.

Note: Output will look funny if you define more than one output listener that prints to STDOUT.

METHODS

If you want to implement an output listener you must implement the following methods:

$obj -> global_start ()

This method is called once for a testplan before further processing is done. You may use it to open files, etc.

$obj -> global_end ()

This method is called once for a testplan after all processing is done. You may use it to close files, etc.

$obj -> item_pre ($arg)

This method is called before any request is done. The argument is a hash that defines the values for this single request. This hash is defined within the testplan, see the XML representation of <request> in WWW::Webrobot::pod::Testplan or dump it.

        use Data::Dumper; print Dumper $arg;
$obj -> item_post($r, $arg)

This method is called after any request has completed.

$r is a HTTP::Response object. It contains the both the request and the response.

There may be situations where your testplan request results in a authentification or redirecting response (got a 401 authenticate response or 3xx redirect response).

In this case Webrobot does the necessary follow up requests as defined in LWP::UserAgent. You may access any chaining requests via the _previous Attribute.

$arg is the same as in item_pre

IMPLEMENTING CLASSES

WWW::Webrobot::Print::Test

This listener produces output for Test::Harness on STDOUT. Preferred listener for terminal output.

WWW::Webrobot::Print::Html

This listener generates a bunch of HTML files to be viewed with a web browser. No output to STDOUT.

WWW::Webrobot::Print::Text

This listener produces output as plain text on STDOUT. Still working but no longer maintained, use WWW::Webrobot::Print::Test instead.

WWW::Webrobot::Print::File

Write response content to the file system and diff to a previous run. Prints to STDOUT in diff-mode only.

WWW::Webrobot::Print::MakeTestplan

Write out all visited urls. This is usefull if you run WWW::Webrobot::Recur::LinkChecker or WWW::Webrobot::Recur::Browser where additional urls are visited. The output format is suitable for webrobot-gen-plan.

SEE ALSO

WWW::Webrobot::pod::Config

WWW::Webrobot

AUTHOR

Stefan Trcek

COPYRIGHT

Copyright(c) 2004 ABAS Software AG

This software is licensed under the perl license, see LICENSE file.