=encoding utf8 =head1 NAME =begin original HTTP::WebTest::API - API of HTTP::WebTest =end original HTTP::WebTest::API - HTTP::WebTest の API =head1 SYNOPSIS 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); =head1 DESCRIPTION =begin original This document describes Perl API of C. =end original このドキュメントでは C の Perl API について 記述しています. =head1 METHODS (メソッド) =head2 new () =begin original Constructor. =end original コンストラクタ. =head3 Returns (復帰値) =begin original A new C object. =end original 新しい C オブジェクト. =head2 run_tests ($tests, $optional_params) =begin original Runs a test sequence. =end original テストシーケンスの実行. =head3 Parameters (パラメータ) =over 4 =item * $test =begin original A reference to an array that contains test objects. =end original テストオブジェクトを格納した配列へのリファレンス. =item * $optional_params =begin original A reference to a hash that contains optional global parameters for test. =end original 任意のテストのためのグローバルパラメータを格納したハッシュへのリファレンス. =back =head2 run_wtscript ($wtscript, $optional_params) =begin original Reads wtscript and runs tests it defines. =end original wtscript を読み込みそこで定義されているテストを実行する. =head3 Parameters (パラメータ) =over 4 =item * $wtscript =begin original Either the name of wtscript file or wtscript passed as string. Very simple heuristic is used distinguish first from second. If C<$wtscript> contains either C<\n> or C<\r> it is treated as a wtscript string. Otherwise, it is treated as a file name. =end original wtscript ファイルの名前もしくはwtscriptそのもの. とても単純な方法で 両指定は識別されます. もし C<$wtscript> が C<\n> もしくは C<\r> を 含んでいればそれは wtscript 文字列として処理されます. そうでなければ ファイル名として処理されます. =item * $optional_params =back =begin original A reference to a hash that contains optional test parameters that can override parameters defined in wtscript. =end original wtscript で定義されているパラメータを上書きする任意のテストパラメータを 含んだハッシュへのリファレンス. =head2 num_fail () =head3 Returns (復帰値) =begin original The number of failed tests. =end original 失敗したテストの数. =head2 num_succeed () =head3 Returns (復帰値) =begin original The number of passed tests. =end original 成功したテストの数. =head2 have_succeed () =head3 Returns (復帰値) =begin original True if all tests have passed, false otherwise. =end original 全てのテストが成功したときに真, そうでなければ偽. =head2 parser_package($optional_parser_package) =begin original If $optional_parser is defined sets a parser package to use when parsing wtscript files. Otherwise just returns current parser package. =end original $optional_parser が定義されていれば wtscript ファイルを解析するときに 使われるパーサパッケージとして設定する. そうでなければ現在のパーサパッケージを返す. =head3 Returns (復帰値) =begin original The parser package. =end original パーサーパッケージ. =head2 parse ($data) =begin original Parses test specification in wtscript format. =end original wtscript フォーマットのテスト記述を解析する. =head3 Parameters (パラメータ) =over 4 =item * $data =begin original Scalar that contains test specification in wtscript format. =end original wtscript フォーマットのテスト記述を含んだスカラー. =back =head3 Returns (復帰値) =begin original 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. =end original 2つの要素を持つリスト. 1つ目はテストオブジェクトを格納した配列への リファレンス. 2つ目は任意のグローバルテストパラメータ含んだハッシュへの リファレンス. =begin original It can be passed directly to C. =end original これらの値は直接 C に渡すことができます. =head3 Example $webtest->run_tests($webtest->parse($data)); =head1 LOW-LEVEL API METHODS (低レベル API メソッド) =begin original Most users don't need to use this part of C API directly. It could be useful for users who want to: =end original 大抵のユーザはこのセクションの C API を 直接使う必要はありません. これらは次のことを行いたいユーザには 便利でしょう: =over 4 =item * =begin original Write an C plugin. =end original C プラグインを書くとき. =item * =begin original Get access to L, L, L and other objects used by C during runing test sequence. =end original L, L, L 及びテストシーケンスの実行中に C が使うその他のオブジェクト等にアクセスしたいとき. =back =head2 tests () =head3 Returns (復帰値) =begin original A reference to an array that contains test objects. =end original テストオブジェクトを格納する配列へのリファレンス. =head2 user_agent ($optional_user_agent) =begin original If $optional_user_agent is a user agent object, it is used by the C object for all requests. If $optional_user_agent is passed as undef, the HTTP::WebTest object is reset to use the default user agent. =end original $optional_user_agent がユーザエージェントオブジェクトであれば C の全てのリクエストでそれを使うようになります. もし $optional_user_agent に undef を渡されたなら, HTTP::WebTest オブジェクトのユーザエージェントはデフォルトのものに リセットされます. =head3 Returns (復帰値) =begin original The user agent object used by the C object. =end original C オブジェクトによって使われるユーザエージェントオブジェクト. =head2 plugins ($optional_plugins) =begin original If C<$optional_plugins> is a reference to an array that contains plugin objects, the C object uses these plugins while running tests. If C<$optional_plugins> is passed as undef, the C object is reset to use the default set of plugins. =end original C<$optional_plugins> にプラグインオブジェクトを格納した配列へのリファレンス を渡したときは C はテストの実行中にそれらのプラグインを使うように なります. もし C<$optional_plugins> に undef を渡したときはデフォルトの プラグインセットにリセットされます. =head3 Returns (復帰値) =begin original 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 C object during tests. =end original プラグインオブジェクトを格納した配列へのリファレンス. もしその配列のプラグインオブジェクトを追加もしくは削除すると テスト中に C オブジェクトが使うプラグインのセットを 変更することになります. =head2 create_user_agent () =head3 Returns (復帰値) =begin original A new L object, initialized with default settings. =end original デフォルトの設定で初期化された新しい L オブジェクト. =head2 reset_user_agent () =begin original Resets the user agent to the default. =end original ユーザエージェントをデフォルトのものにリセットします. =head2 reset_plugins () =begin original Resets the set of plugin objects to the default set. =end original プラグインオブジェクトをデフォルトのものにリセットします. =head2 default_plugins () =head3 Returns (復帰値) =begin original A reference to the set of default plugin objects. =end original デフォルトのプラグインオブジェクトのセットへのリファレンス. =head2 global_test_param ($param) =head3 Returns (復帰値) =begin original The value of the global test parameter C<$param>. =end original グローバルテストパラメータ C<$param> の値. =head2 current_test_num () =head3 Returns (復帰値) =begin original The number of the current test or, if no test is running, the current test run. =end original 現在のテストの番号. もしくは実行中でなければ最後に実行されたテストの番号. =head2 current_test () =head3 Returns (復帰値) =begin original The L object which corresponds to the current test or, if no test is running, the current test run. =end original 現在のテストに対応する L オブジェクト. もしくは実行中でなければ最後に実行されたテストオブジェクト. =head2 current_request () =head3 Returns (復帰値) =begin original The L object used in current test. =end original 現在のテストで使われている L オブジェクト. =head2 current_response () =head3 Returns (復帰値) =begin original The L object used in current test. =end original 現在のテストで使われている L オブジェクト. =head2 current_response_time () =head3 Returns (復帰値) =begin original The response time for the HTTP request used in current test. =end original 現在のテストでの HTTP リクエストに対するレスポンスタイム. =head2 current_results () =head3 Returns (復帰値) =begin original A reference to an array that contains the results of checks made by plugins for the current test. =end original 現在のテストに対するプラグインからのテスト結果を格納している配列への リファレンス. =head2 run_test ($test, $optional_params) =begin original Runs a single test. =end original 1つのテストを実行. =head3 Parameters (パラメータ) =over 4 =item * $test =begin original A test object. =end original テストオブジェクト. =item * $optional_params =begin original A reference to a hash that contains optional global test parameters. =end original 任意のグローバルテストパラメータを格納しているハッシュへのリファレンス. =back =head2 convert_tests (@tests) =begin original Converts test objects C<@tests> of any supported type to internal canonical representation (i.e. to L objects). =end original 多ポートされているタイプのテストオブジェクト C<@tests> を内部の標準表現(つまり L オブジェクト)に変換する. =head3 Returns (復帰値) =begin original A list of L objects (list context) or the first value from a list of L objects (scalar context). =end original リストコンテキストでは L オブジェクトのリスト, スカラーコンテキストでは L オブジェクトのリストの 先頭の値. =head1 BACKWARD COMPATIBILITY (下位互換性) =begin original C offers a richer API than its predecessor C. The old API is still supported, but may be deprecated in the future and is not recommended. =end original C は前任の C よりも リッチな API を提供しています. 古い API も今のところサポートされていますが 今後廃止されるでしょう. また, これらの使用は推奨されません. =head2 web_test ($file, $num_fail_ref, $num_succeed_ref, $optional_options) =begin original Reads wtscript file and runs tests it defines. =end original wtscript ファイルを読み込みそこで定義されているテストを実行する. =begin original In C you should use method C. =end original C では C メソッドを使うべきです. =head3 Parameters (パラメータ) =over 4 =item * $file =begin original Name of a wtscript file. =end original wtscript ファイルの名前. =item * $num_fail_ref =begin original A reference on scalar where a number of failed tests will be stored or C if you don't need it. =end original 失敗したテストの数を格納するスカラーへのリファレンス. 必要なければ undef を指定できます. =item * $num_succed_ref =begin original A reference on scalar where a number of passed tests will be stored or C if you don't need it. =end original パス(成功)したテストの数を格納するスカラーへのリファレンス. 必要なければ undef を指定できます. =item * $optional_params =begin original A reference to a hash that contains optional test parameters which can override parameters defined in wtscript. =end original wtscript で定義されているパラメータを上書きすることができる 任意のテストパラメータを格納したハッシュへのリファレンス. =back =head2 run_web_test ($tests, $num_fail_ref, $num_succeed_ref, $optional_options) =begin original This is not a method. It is subroutine which creates a C object and runs test sequence using it. =end original これはメソッドではありません. C オブジェクトを 生成しそれを使ってテストシーケンスを実行するサブルーティンです. =begin original You need to either import C into you namespace with =end original 以下の文で C をインポートするか, use HTTP::WebTest qw(run_web_test); =begin original or use the full name C =end original 完全な名前 C を使う必要があります. =begin original In C you should use the method C. =end original C ではC メソッドを使うべきです. =head3 Parameters (パラメータ) =over 4 =item * $tests =begin original A reference to an array that contains a set of test objects. =end original テストオブジェクトのセットを格納する配列へのリファレンス. =item * $num_fail_ref =begin original A reference to a scalar where the number of failed tests will be stored or C if you don't need it. =end original 失敗したテストの数を格納するスカラーへのリファレンス. 必要なければ undef を指定できます. =item * $num_succed_ref =begin original A reference to a scalar where the number of passed tests will be stored or C if you don't need it. =end original パス(成功)したテストの数を格納するスカラーへのリファレンス. 必要なければ undef を指定できます. =item * $optional_params =begin original A reference to a hash that contains optional test parameters. =end original 任意のテストパラメータを格納するハッシュへのリファレンス. =back =head1 COPYRIGHT Copyright (c) 2000-2001 Richard Anderson. All rights reserved. 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 L L L L L L L