NAME
HTTP::WebTest::Plugin - Base class for HTTP::WebTest plugins.
SYNOPSIS
Not applicable.
DESCRIPTION
HTTP::WebTest plugin classes can subclass this class. It provides some useful helper methods.
METHODS
new ($webtest)
Constructor.
Returns
A new plugin object which will be used by HTTP::WebTest object $webtest
.
webtest ()
Returns
A HTTP::WebTest object which uses this plugin.
global_test_param ($param, $optional_default)
Returns
If global test parameter $param
is not defined returns $optional_default
or undef
if it is not defined also.
If global test parameter $param
is defined returns it's value.
test_param ($param, $optional_default)
Returns
If latest test parameter $param
is not defined returns $optional_default
or undef
if it is not defined also.
If latest test parameter $param
is defined returns it's value.
global_yesno_test_param ($param, $optional_default)
Returns
If global test parameter $param
is not defined returns $optional_default
or false if it is not defined also.
If global test parameter $param
is defined returns true if latest test parameter $param
is yes
. False otherwise.
yesno_test_param ($param, $optional_default)
Returns
If latest test parameter $param
is not defined returns $optional_default
or false if it is not defined also.
If latest test parameter $param
is defined returns true if latest test parameter $param
is yes
. False otherwise.
test_result ($ok, $comment)
Factory method which creates test result object.
Returns
A HTTP::WebTest::TestResult object.
validate_params (@params)
Checks test parameters listed in @params
. Throws exception if any of them are invalid.
global_validate_params (@params)
Checks global test parameters listed in @params
. Throws exception if any of them are invalid.
validate_value($param, $value, $type)
Checks if $value
of test parameter $param
has type <$type>.
Exceptions
Dies if check is not successful.
param_types ()
Method which should be redefined in subclasses. Returns information about test parameters which are supported by plugin. Used to validate tests.
Returns
A string which looks like:
'param1 type1
param2 type2
param3 type3(optional,args)
param4 type4'
check_anything ($value)
Method which checks test parameter if it is value is of anything
type.
This is NOOP operation. It always succeed.
check_list ($param, $value, @optional_spec)
Method which checks test parameter if it is value is of list
type. That is it is a reference on an array.
Optional list @optional_spec
can define specification on allowed elements of list. It can be either
('TYPE_1', 'TYPE_2', ..., 'TYPE_N')
or
('TYPE_1', 'TYPE_2', ..., 'TYPE_M', '...')
First specification requires list value of test parameter to contain N
elements. First element of list should be of should TYPE_1
type, second element of list should of TYPE_2
type, ..., N-th element of list should be of TYPE_N
type.
Second specification requires list value of test parameter to contain at least N
elements. First element of list should be of should TYPE_1
type, second element of list should of TYPE_2
type, ..., M-th element of list should be of TYPE_M
type, all following elements should be of TYPE_M
type.
Exceptions
Dies if checks is not successful.
check_scalar ($param, $value, $optional_regexp)
Method which checks test parameter if it is value is of scalar
type. That is it is usual Perl scalar and is not a reference.
If $optional_regexp
is specified also checks value of parameter using this regual expression.
Exceptions
Dies if check is not successful.
check_stringref ($param, $value)
Method which checks test parameter if it is value is of stringref
type. That is it is a reference on scalar.
Exceptions
Dies if check is not successful.
check_uri ($param, $value)
Method which checks test parameter if it is value is of uri
type. That is it either scalar or URI object.
Exceptions
Dies if check is not successful.
check_hashlist ($param, $value)
Method which checks test parameter if it is value is of hashlist
type. That is it is either a hash reference or an array reference which points to array containing even number of elements.
Exceptions
Dies if check is not successful.
check_yesno ($param, $value)
Same as
check_scalar($param, $value, '^(?:yes|no)$');
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.