NAME

HTTP::WebTest::Plugin::Hooks - Provides callbacks called during test run

SYNOPSIS

plugins = ( ::Hooks )

test_name = Name1
    ....
    # do some test initialization
    on_request = { My::init() }
end_test

test_name = Name2
    ....
    # define custom test
    on_response = ( { My::test() ? 'yes' : 'no' } => 'My test' )
end_test

test_name = Name3
    ....
    # call finalization code with returning any test results
    on_response = { My::finalize(); return [] }
end_test

DESCRIPTION

This plugin module adds test parameters which values are evaluated at specific time of HTTP::WebTest test run. It can be used to do some initialization before doing test request, to do some finalization when test response is received or to implement user defined tests without need to write separate plugin module.

TEST PARAMETERS

on_request

Value of this test parameter is ignored. However it is evaluted before test request to web page is done so it is useful to do some initalization before the request.

on_response

This is a list parameter which is treated as test result. It is evaluted when response for the test request is received.

It can be useful to define custom tests without writting new plugins and/or it can be useful to run some code when response for the test request is received.

Allowed values

( YESNO1, COMMENT1
  YESNO2, COMMENT2
  ....
  YESNON, COMMENTN )

Here YESNO, COMMENT - is a test result. YESNO - is either yes if test is successful or no if it is not. COMMENT is a text of comment associated with this test.

Example

See example in HTTP::WebTest::Cookbook.

COPYRIGHT

Copyright (c) 2001,2002 Ilya Martynov. All rights reserved.

This module is free software. It may be used, redistributed and/or modified under the terms of the Perl Artistic License.

SEE ALSO

HTTP::WebTest

HTTP::WebTest::API

HTTP::WebTest::Plugin

HTTP::WebTest::Plugins