HTTP-WebTest-2.04 > HTTP::WebTest::Plugins
HTTP-WebTest-2.04

名前

HTTP::WebTest::Plugins - Plugin developers documentation.

HTTP::WebTest::Plugins - Plugin 開発者向けドキュメント

概要

Not applicable.

なし.

説明

This document is the starting point for developers who wish to extend HTTP::WebTest functionality with external plugins.

このドキュメントは HTTP::WebTest を外部プラグインを つかって拡張しようとする開発者のスタート地点です.

ABOUT 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.

プラグインは新しいテストタイプやレポートタイプを追加することができます. プラグインはテストの様々な局面で HTTP::WebTest から 呼び出されるいくつかのメソッドをクラスとして定義している Perl パッケージ にすぎません.

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.

各プラグインパッケージは HTTP::WebTest::Plugin のサブクラスであるべきです. レポートプラグインは HTTP::WebTest::Plugin のサブクラスである HTTP::WebTest::ReportPlugin のサブクラス でもよいです. HTTP::WebTest::ReportPlugin ではレポートプラグインに役立ついくつかのヘルパーメソッドや レポートプラグインが共通して行うテストパラメータの操作を定義しています.

必要なメソッド

Each plugin package must provide following method:

各プラグインパッケージは以下のメソッドを提供しなければなりません:

param_types

復帰値

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.

PARAM がテストパラメータの名前, TYPE がタイプの指定です. 白空白文字で区切ってください.

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.

各テストパラメータタイプは HTTP::WebTest::Plugin のメソッドとして定義されています. タイプ foobar は メソッド check_foobar として定義されています. 全ての check_**** メソッドの 一覧はそのドキュメント(訳注:おそらく HTTP::WebTest::Pluginのこと)を参照してください. この名前のメソッドはすべて既知のテストタイプとして定義されています.

Example

    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.

これは HTTP::WebTest::Plugin::TextMatchTest. にあるものです. ここではテストパラメータ ignore_case, text_forbid, text_require, regex_forbid, そして regex_require を定義しています. yesno 及び list はテストパラメータタイプです.

任意のメソッド

Each plugin package may provide following methods:

各プラグインパッケージでは以下のメソッド提供することもできます:

start_tests ()

Called before runing test sequence. Initializations can be done in this method. Report plugins can use this hook to create the report header.

テストシーケンスを実行する前に呼び出されます. このメソッドで 初期化を行うことができます. レポートプラグインではこのメソッドで レポートのヘッダを作ることができます.

end_tests ()

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.

テストシーケンスが終了するときに呼び出されます. このメソッドで クリーンアップや終了処理を行うことができます. レポートプラグインでは このメソッドでレポートを終了させることができます.

prepare_request ()

Called just before HTTP::WebTest submits the HTTP request. Various properties of request can be set here.

HTTP::WebTest が HTTP リクエストを送信する直前に 呼び出されます. リクエストに対する様々な属性をここで設定することができます.

check_response ()

Called after HTTP::WebTest gets the HTTP response. Web page tests should be placed here.

HTTP::WebTest が HTTP レスポンスを受け取った後に 呼び出されます. ウェブページをここでテストします.

report_test ()

Called after all HTTP::WebTest <check_response> hooks are called. Normally used by report plugins to generate report about test just done.

全ての HTTP::WebTest <check_response> フックを呼び終えた 後に呼び出されます. 通常レポートプラグインが今終わったテストに関するレポートを 生成するために使います.

復帰値

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_RESULTHTTP::WebTest::TestResult オブジェクトです.

Some examples of plugins are:

プラグインの例を挙げてみます:

HTTP::WebTest::Plugin::Cookies

Plugin that uses both prepare_request and check_response hooks.

prepare_request 及び check_response の2つのフックを使っています.

HTTP::WebTest::Plugin::StatusTest

Simple plugin that defines only the check_response hook.

check_response フックのみを定義している簡単なプラグイン.

HTTP::WebTest::Plugin::DefaultReport

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.

このプログラムはフリーソフトウェアです. このプログラムは Perl 自身と同じ条件下で再配布・改変可能です.

SEE ALSO

HTTP::WebTest

HTTP::WebTest::API

HTTP::WebTest::Plugin

HTTP::WebTest::ReportPlugin