HTTP::WebTest::Plugins - Plugin developers documentation.
Not applicable.
This document is the starting point for developers who wish to extend HTTP::WebTest functionality with external plugins.
Plugin can be used to add new test types and add new report types. A plugin is just a Perl package that defines class with a number of methods which if present are called by HTTP::WebTest at various stages of test.
Each plugin package should subclass HTTP::WebTest::Plugin. Report plugins can subclass HTTP::WebTest::ReportPlugin which is a subclass of HTTP::WebTest::Plugin. HTTP::WebTest::ReportPlugin defines some helper methods useful in report plugins and handles some test parameters common for report plugins.
Each plugin package must provide following method:
A string that contains information about supported test parameters and their types.
String has following format:
PARAM1 TYPE1 PARAM2 TYPE2 PARAM3 TYPE3 ... PARAMN TYPEN
PARAM is the name of a test parameter and TYPE is it's type specification. They should be separated by a whitespace character.
Each test parameter type is defined by a method in HTTP::WebTest::Plugin. Type foobar is defined as method check_foobar in this package. See its documentation for list of all check_**** methods - these methods define all known test types.
foobar
check_foobar
check_****
sub param_types { return q(ignore_case yesno text_forbid list text_require list regex_forbid list regex_require list); }
This is from HTTP::WebTest::Plugin::TextMatchTest. It defines the test parameters ignore_case, text_forbid, text_require, regex_forbid and regex_require. yesno and list are test parameter types.
ignore_case
text_forbid
text_require
regex_forbid
regex_require
yesno
list
Each plugin package may provide following methods:
Called before runing test sequence. Initializations can be done in this method. Report plugins can use this hook to create the report header.
Called when test sequence is finished. Clean-up and finalization can be done in this method. Report plugins can use this hook to finish the report.
Called just before HTTP::WebTest submits the HTTP request. Various properties of request can be set here.
Called after HTTP::WebTest gets the HTTP response. Web page tests should be placed here.
Called after all HTTP::WebTest <check_response> hooks are called. Normally used by report plugins to generate report about test just done.
These methods should return results of tests made in the following form:
[ [ TEST_GROUP1_NAME, TEST_RESULT1, TEST_RESULT2, ... ], [ TEST_GROUP2_NAME, TEST_RESULT1, TEST_RESULT2, ... ], ... ];
TEST_GROUP_NAME is a string that describes a group of web tests and their results. It is used during the generation of the test report.
TEST_GROUP_NAME
TEST_RESULT is an HTTP::WebTest::TestResult object.
TEST_RESULT
Some examples of plugins are:
Plugin that uses both prepare_request and check_response hooks.
prepare_request
check_response
Simple plugin that defines only the check_response hook.
Example of a report plugin. Uses start_tests, report_test and end_tests hooks.
start_tests
report_test
end_tests
Copyright (c) 2001-2003 Ilya Martynov. All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
HTTP::WebTest
HTTP::WebTest::API
HTTP::WebTest::Plugin
HTTP::WebTest::ReportPlugin
To install HTTP::WebTest, copy and paste the appropriate command in to your terminal.
cpanm
cpanm HTTP::WebTest
CPAN shell
perl -MCPAN -e shell install HTTP::WebTest
For more information on module installation, please visit the detailed CPAN module installation guide.