GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
HTTP::WebTest::API(3) User Contributed Perl Documentation HTTP::WebTest::API(3)

HTTP::WebTest::API - API of HTTP::WebTest

    use HTTP::WebTest;

    my $webtest = new HTTP::WebTest;

    # run test from file
    $webtest->run_wtscript('script.wt');

    # or (to pass test parameters as method arguments)
    $webtest->run_tests($tests);

This document describes Perl API of "HTTP::WebTest".

Constructor.

Returns

A new "HTTP::WebTest" object.

Runs a test sequence.

Parameters

  • $test

    A reference to an array that contains test objects.

  • $optional_params

    A reference to a hash that contains optional global parameters for test.

Reads wtscript and runs tests it defines.

Parameters

  • $wtscript

    Either the name of wtscript file or wtscript passed as string. Very simple heuristic is used distinguish first from second. If $wtscript contains either "\n" or "\r" it is treated as a wtscript string. Otherwise, it is treated as a file name.

  • $optional_params

A reference to a hash that contains optional test parameters that can override parameters defined in wtscript.

Returns

The number of failed tests.

Returns

The number of passed tests.

Returns

True if all tests have passed, false otherwise.

If $optional_parser is defined sets a parser package to use when parsing wtscript files. Otherwise just returns current parser package.

Returns

The parser package.

Parses test specification in wtscript format.

Parameters

$data

Scalar that contains test specification in wtscript format.

Returns

A list of two elements. First element is a reference to an array that contains test objects. Second element is a reference to a hash that contains optional global test parameters.

It can be passed directly to "run_tests".

Example

    $webtest->run_tests($webtest->parse($data));

Most users don't need to use this part of "HTTP::WebTest" API directly. It could be useful for users who want to:
  • Write an "HTTP::WebTest" plugin.
  • Get access to LWP::UserAgent, HTTP::WebTest::Request, HTTP::Response and other objects used by "HTTP::WebTest" during runing test sequence.

Returns

A reference to an array that contains test objects.

If $optional_user_agent is a user agent object, it is used by the "HTTP::WebTest" object for all requests. If $optional_user_agent is passed as undef, the HTTP::WebTest object is reset to use the default user agent.

Returns

The user agent object used by the "HTTP::WebTest" object.

If $optional_plugins is a reference to an array that contains plugin objects, the "HTTP::WebTest" object uses these plugins while running tests. If $optional_plugins is passed as undef, the "HTTP::WebTest" object is reset to use the default set of plugins.

Returns

A reference to an array that contains plugin objects. If you add or remove plugin objects in this array, you will change the set of plugins used by "HTTP::WebTest" object during tests.

Returns

A new LWP::UserAgent object, initialized with default settings.

Resets the user agent to the default.

Resets the set of plugin objects to the default set.

Returns

A reference to the set of default plugin objects.

Returns

The value of the global test parameter $param.

Returns

The number of the current test or, if no test is running, the current test run.

Returns

The HTTP::WebTest::Test object which corresponds to the current test or, if no test is running, the current test run.

Returns

The HTTP::WebTest::Request object used in current test.

Returns

The HTTP::Response object used in current test.

Returns

The response time for the HTTP request used in current test.

Returns

A reference to an array that contains the results of checks made by plugins for the current test.

Runs a single test.

Parameters

  • $test

    A test object.

  • $optional_params

    A reference to a hash that contains optional global test parameters.

Converts test objects @tests of any supported type to internal canonical representation (i.e. to HTTP::WebTest::Test objects).

Returns

A list of HTTP::WebTest::Test objects (list context) or the first value from a list of HTTP::WebTest::Test objects (scalar context).

"HTTP::WebTest 2.xx" offers a richer API than its predecessor "HTTP::WebTest 1.xx". The old API is still supported, but may be deprecated in the future and is not recommended.

Reads wtscript file and runs tests it defines.

In "HTTP::WebTest 2.xx" you should use method "run_wtscript".

Parameters

  • $file

    Name of a wtscript file.

  • $num_fail_ref

    A reference on scalar where a number of failed tests will be stored or "undef" if you don't need it.

  • $num_succed_ref

    A reference on scalar where a number of passed tests will be stored or "undef" if you don't need it.

  • $optional_params

    A reference to a hash that contains optional test parameters which can override parameters defined in wtscript.

This is not a method. It is subroutine which creates a "HTTP::WebTest" object and runs test sequence using it.

You need to either import "run_web_test" into you namespace with

    use HTTP::WebTest qw(run_web_test);

or use the full name "HTTP::WebTest::run_web_test"

In "HTTP::WebTest 2.xx" you should use the method "run_tests".

Parameters

  • $tests

    A reference to an array that contains a set of test objects.

  • $num_fail_ref

    A reference to a scalar where the number of failed tests will be stored or "undef" if you don't need it.

  • $num_succed_ref

    A reference to a scalar where the number of passed tests will be stored or "undef" if you don't need it.

  • $optional_params

    A reference to a hash that contains optional test parameters.

Copyright (c) 2000-2001 Richard Anderson. All rights reserved.

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::Cookbook

HTTP::WebTest::Plugins

HTTP::WebTest::Request

LWP::UserAgent

HTTP::Response

HTTP::WebTest::Cookies

HTTP::WebTest::Parser

HTTP::WebTest::Plugin

HTTP::WebTest::Test

2003-03-02 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.