=encoding utf8 =head1 NAME =begin original HTTP::WebTest::SelfTest - Helper package for HTTP::WebTest test suite =end original HTTP::WebTest::SelfTest - HTTP::WebTest テストスイート用のヘルパーパッケージ =head1 SYNOPSIS use HTTP::WebTest::SelfTest; =head1 DESCRIPTION =begin original This module provides helper routines used by L self test suite. Plugin writers may find this module useful for implementation of test suites for their plugins. =end original このモジュールでは L 自身のテストスイートで使われる ヘルパーメソッドを提供します. プラグインの制作者は作っているプラグインの テストスイートの実装に役立つものが見付かるかもしれません. =head1 GLOBAL VARIABLES (グローバル変数) =begin original This module imports in namespace of test script following global variables. =end original このモジュールは以下のグローバル変数をテストスクリプトの名前空間に インポートします. =head2 $HOSTNAME =begin original The hostname of the test webserver. =end original テストウェブサーバのホスト名. =head2 $PORT =begin original The port of the test webserver. =end original テストウェブサーバのポート. =head2 $URL =begin original The URL of the test webserer. =end original テストウェブサーバの URL. =head1 SUBROUTINES (サブルーティン) =begin original This module imports in namespace of test script following helper subroutines. =end original このモジュールは以下のヘルパ関数をテストスクリプトの名前空間に インポートします. =head2 abs_url($base, $rel) =head3 Return (復帰値) =begin original Returns absolute URL based on pair of base and relative URLs. =end original ベース及び相対 URL のペアからなる絶対 URL を返します. =head2 read_file($filename, $ignore_errors) =begin original Reads a file. =end original ファイルを読み込みます. =head3 Parameters (パラメータ) =over 4 =item $filename =begin original Name of the file. =end original ファイルの名前. =item $ignore_errors =begin original (Optional) If true then open file errors are ignored, otherwise they raise an exception. If omit defaults to true. =end original (任意) 死んであればファイルを開くときのエラーは無視されます. そうでなければ例外を発生させます. 省略時は真です. =back =head3 Returns (復帰値) =begin original Whole content of the file as a string. =end original ファイルの中身全体を文字列として返します. =head2 write_file($filename, $data) =begin original Writes into a file. =end original ファイルに書き込み. =head3 Parameters (パラメータ) =over 4 =item $filename =begin original Name of the file. =end original ファイル名. =item $data =begin original Data to write into the file. =end original ファイルに書き込むデータ. =back =head2 check_webtest(%params) =begin original Runs a test sequence and compares output with a reference file. =end original テストシーケンスを実行してその出力をリファレンスファイルと比較します. =head3 Parameters (パラメータ) =over 4 =item webtest => $webtest =begin original L object to be used for running the test sequence. =end original テストシーケンスの実行に使う L オブジェクト. =item tests => $tests =begin original The test sequence. =end original テストシーケンス. =item tests => $opts =begin original The global parameters for the test sequence. =end original テストシーケンスのためのグローバルパラメータ. (訳注: 原文では C $opts> となっていたが恐らく誤り.) =item out_filter => $out_filter =back =head2 generate_testfile(%params) =begin original Generates test file from template file. I.e. it replaces substring '<>' with value of named parameter C. =end original テンプレートファイルからテストファイルを生成. 部分文字列 '<>' は名前付きパラメータ C の値で 置き換えられます. =head3 Parameters (パラメータ) =over 4 =item file => $file =begin original Filename of test file. Template file is expected to be in file named "$file.in". =end original テストファイルのファイル名. テンプレートファイルは "$file.in" の名前を もつ必要があります. =item server_url => $server_url =begin original Test webserver URL. =end original テストサーバの URL. =back =head2 canonical_output(%params) =begin original Some substrings in test output are unique for each test run. This subroutine "fixes" test output so it becomes repeatable (unless tests get broken). =end original テストの出力中のいくつかの部分文字列を各テストの実行毎にユニークな ものに置き換えます. この関数ではテストの出力を"修正"するため(テストが 壊れていない限りは)繰り返し可能です. =head3 Parameters (パラメータ) =over 4 =item output_ref => $output_ref =begin original A reference on scalar which contains test output as whole string. =end original テストの結果を文字列全体として格納するスカラーへのリファレンス. =item out_filter => $out_filter =begin original An optional reference on subroutine which can be used as additional filter. It gets passed test output as its first parameter. =end original 追加フィルタとして使われる関数へのリファレンス. 任意. 1番目の引数に テストの出力が渡されます. =item server_url => $server_url =begin original Test webserver URL. Normally it is unique for each test run so it gets replaced with C. =end original ウェブサーバ URL をテストします. 通常これは各テストの実行毎にユニーク であるため C で置き換えられます. =item server_hostname => $server_hostname =begin original Test webserver URL. Normally it is unique for each machine where test is run so it gets replaced with C. =end original ウェブサーバ URL をテストします. 通常これは各マシン毎にユニーク であるため C で置き換えられます. =back =head2 compare_output(%params) =begin original Tests if a test output matches content of specified reference file. If environment variable C is set then the test is always succeed and the content of the reference file is overwritten with current test output. =end original テスト出力が指定されたリファレンスファイルの内容と一致するかテストします. もし環境変数 C が設定されていればテストは常に成功し, リファレンスファイルの内容をテスト結果で上書きします. =head3 Parameters (パラメータ) =over 4 =item output_ref => $output_ref =begin original A reference on scalar which contains test output as whole string. =end original テストの結果を文字列全体として格納するスカラーへのリファレンス. =item check_file => $check_file =begin original Filename of the reference file. =end original リファレンスファイルのファイル名. =back =head2 parse_basic_credentials($credentials) =begin original Decodes credentials for Basic authorization scheme according RFC2617. =end original RFC 2617 に対応するベーシック認証スキーマのデコードを行います. =head3 Returns (復帰値) =begin original Returns user/password pair. =end original ユーザ/パスワードのペア. =head1 DEPRECATED SUBROUTINES (廃止された関数) =begin original This module imports in namespace of test script following helper subroutines but they are deprecated and may be removed in the future from this module. =end original このモジュールは以下のヘルパ関数もテストスクリプトの名前空間に インポートしますがこれらは廃止されています. 今後削除されるでしょう. =head2 start_webserver =begin original This subroutine was moved into L but for backward compatibility purposes can be exported from this module. =end original この関数は L に 移動されました. 下位互換のためにこのモジュールからエクスポートされています. =head2 stop_webserver =begin original This subroutine was moved into L but for backward compatibility purposes can be exported from this module. =end original この関数は L に 移動されました. 下位互換のためにこのモジュールからエクスポートされています. =head1 COPYRIGHT Copyright (c) 2001-2003 Ilya Martynov. All rights reserved. =begin original This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =end original このプログラムはフリーソフトウェアです. このプログラムは Perl 自身と同じ条件下で再配布・改変可能です. =head1 SEE ALSO L L L