The Jakarta Project

About

Documentation

Community

4.0 Elements of a Test Plan テストプランの要素
4.1 ThreadGroup スレッドグループ

Thread group elements are the beginning points of any test plan. All elements of a test plan must be under a thread group. As the name implies, the thread group element controls the number of threads JMeter will use to execute your test. The controls for a thread group allow you to:

  • Set the number of threads
  • Set the ramp-up period
  • Set the number of times to execute the test

どのようなテストプランにおいてもスレッドグループ要素が最初の要素となります。 テストプランの全ての要素は全てスレッドグループの配下に収められます。 名前のとおり、スレッドグループ要素はJMeterが実行するスレッドの数をコントロールします。 スレッドグループでコントロールできるのは以下のとおりです。

  • スレッド数
  • ramp-up時間
  • テストの実行回数

Each thread will execute the test plan in its entirety and completely independent of other test threads. Multiple threads are used to simulate concurrent connections to your server application.

各スレッドは他のテストスレッドとは完全に独立して実行されます。 サーバーアプリケーションに対する複合的な接続をシミュレートするために複数のスレッドが利用されます。

The ramp-up period tells JMeter how long to take to "ramp-up" to the full number of threads chosen. If 10 threads are used, and the ramp-up period is 100 seconds, then JMeter will take 100 seconds to get all 10 threads up and running. Each thread will start 10 (100/10) seconds after the previous thread was begun. If there are 30 threads and a ramp-up period of 120 seconds, then each successive thread will be delayed by 4 seconds.

ramp-up時間は、指定した数のスレッドを立ち上げるまでにどの程度の時間をかけるかを指定します。 もしスレッド数を10、そのramp-up時間を100秒にセットした場合、 JMeterは100秒の間に10スレッド全てを起動します。 各スレッドは前のスレッドが起動してから10(100/10)秒経ってから起動します。 もしスレッド数を30、ramp-up時間を120秒にした場合、 各スレッドは4秒ずつ遅延しながら起動してゆきます。

By default, a thread group is configured to loop indefinitely through its elements. Alternatively, you can set the number of times the thread group will loop before ending. If the number is set at one, then JMeter will execute the test only once before stopping.

デフォルトでは、スレッドグループはその要素を無限に実行しつづけます。 ループ回数を指定することもできます。もしループ回数を1にセットした場合は、 JMeterはそのテストを1回しか実行しません。

4.2 Controllers コントローラー

JMeter has two types of Controllers: Generative and Logical.

JMeterのコントローラーには主コントローラーとロジックコントローラーの 二種類があります。

Generative Controllers tell JMeter to send requests to a server. For example, add an HTTP Request Generative Controller if you want JMeter to send an HTTP request. You can also customize a request by adding one or more Configuration Elements to a Generative Controller. For more information, see Generative Controllers.

主コントローラーはJMeterにサーバへリクエストを送るよう指示します。 例えば、JMeterにHTTPリクエストを送らせるには、HTTP主コントローラーを追加します。 主コントローラーにひとつ以上の設定要素を追加することでカスタマイズすることもできます。 詳細はGenerative コントローラーをご覧ください。

Logical Controllers let you customize the logic that JMeter uses to decide when to send requests. For example, you can add an Interleave Logic Controller to alternate between two HTTP Request Generative Controllers. Also, one particular Logic Controller, the Modification Manager, lets you modify the results of a request. For more information, see Logical Controllers.

論理コントローラーによってJMeterがいつリクエストを送信するかをカスタマイズすることができます。 例えば、二つのHTTP主コントローラーの間に論理コントローラーを挟み込むことができます。 同様に、あるひとつの論理コントローラーや修飾マネージャで リクエストの結果を修飾することができます。 詳しくはロジックコントローラーを参照してください。

4.2.1 Generative Controllers 主コントローラー

Generative Controllers tell JMeter to send requests to a server. JMeter currently has three such controllers: FTP Request, HTTP Request, and JDBC request. Each controller has several properties you can set. You can further customize a controller by adding one or more Configuration Elements to it. Also, note that JMeter sends requests in the order that you add them to the tree.

主コントローラーでサーバーにリクエストを送ります。 現在、JMeterはFTPリクエスト、HTTPリクエスト、JDBCリクエストの3つの主コントローラーがあります。 各コントローラーにおいて様々なプロパティをセットできます。 ひとつ以上の設定要素を追加することによってさらにカスタマイズすることもできます。 また、JMeterはツリー上の順でリクエストを送信することに注意してください。

If you are going to send multiple requests of the same type (for example, HTTP Request) to the same server, consider using a Defaults Configuration Element. Each controller has its own Defaults element (see below).

同じタイプのリクエストを同じサーバーに複数送る場合(例えばHTTPリクエスト)、 デフォルト設定に注意してください。 コントローラーはそれぞれデフォルトの要素を持っています。(下記を参照)

Remember to add a Listener to your Thread Group to view and/or store the results of your requests to disk.

スレッドグループにリスナーを追加すると、 リクエストの結果を見たり記録したりすることができます。

If you are interested in having JMeter perform basic validation on the response of your request, add an Assertion to the Request controller. For example, in stress testing a web application, the server may return a successful "HTTP Response" code, but the page may have errors on it or may be missing sections. You could add assertions to check for certain HTML tags, common error strings, and so on. JMeter lets you create these assertions using regular expressions.

リクエストに対するレスポンスについてJMeterが基本的な検証をするようにしたい場合、 アサーションをリクエストコントローラーに追加してください。 例えば、Webアプリケーションの負荷テストにおいて、 サーバーが成功を示すHTTPレスポンスコードを送ってきたとしても、 ページにはエラーがあったり欠けていたりする場合があります。 アサーションを追加することによって、 正しいHTMLタグや一般的なエラー文字列をチェックすることができます。

JMeter's built-in generative controllers JMeter内蔵の主コントローラー

4.2.2 Logic Controllers ロジックコントローラー

Logic Controllers let you customize the logic that JMeter uses to decide when to send requests. Logic Controllers may have as child elements any of the following: Generative Controllers (requests), Configuration Elements, and other Logic Controllers. Logic Controllers can change the order of requests coming from their child elements. They can modify the requests themselves, cause JMeter to repeat requests, etc.

ロジックコントローラーによって、 いつリクエストを送信するのかというロジックをカスタマイズすることができます。 ロジックコントローラーには以下の要素を子要素として追加することができます: 主コントローラー(リクエスト)、設定要素、その他のロジックコントローラー。 ロジックコントローラーは子要素の内容に合わせリクエストの順序を変更することができます。 リクエスト自体を変更したり、再度リクエストさせるなどもできます。

To understand the effect of Logic Controllers on a test plan, consider the following test tree:

テストプラン上のロジックコントローラの効果を理解するために、 以下のようなテストツリーを考えてみましょう。

  • Test Plan
  • テストプラン
    • Thread Group
    • スレッドグループ
      • Once Only Controller
      • 一度だけ実行されるコントローラー
        • Login Request (an )
        • ログインリクエスト ()
      • Load Search Page (HTTP Generative Controller)
      • 検索ページのロード(HTTP主コントローラー)
      • Interleave Controller
      • インターリーブコントローラー
        • Search "A" (HTTP Generative Controller)
        • "A"を検索(HTTP主コントローラー)
        • Search "B" (HTTP Generative Controller)
        • "B"を検索(HTTP主コントローラー)
        • HTTP default request (Configuration Element)
        • HTTPリクエスト設定(各種設定)
      • HTTP default request (Configuration Element)
      • HTTPリクエスト設定(各種設定)
      • Cookie Manager (Configuration Element)
      • クッキーマネージャ(各種設定)

The first thing about this test is that the login request will be executed only the first time through. Subsequent iterations will skip it. This is due to the effects of the .

このテストにおいて、ログインリクエストは一度しか送られません。 その後の動作ではスキップされます。 これはの効果です。

After the login, the next Generative Controller loads the search page (imagine a web application where the user logs in, and then goes to a search page to do a search). This is just a simple request, not filtered through any Logic Controller.

ログイン後は、次の主コントローラーが検索ページをロードします (Webアプリケーションにおいて、ユーザーがログイン後に検索ページへ行って検索するイメージです)。 これはシンプルなリクエストであり、どのロジックコントローラーのフィルターも通りません。

After loading the search page, we want to do a search. Actually, we want to do two different searches. However, we want to re-load the search page itself between each search. We could do this by having 4 simple HTTP request elements (load search, search "A", load search, search "B"). Instead, we use the which passes on one child request each time through the test. It keeps the ordering (ie - it doesn't pass one on at random, but "remembers" its place) of its child elements. Interleaving 2 child requests may be overkill, but there could easily have been 8, or 20 child requests.

検索ページをロード後、検索をします。ここで、二つの違う検索をしたいとしましょう。 しかし、二つの検索の間に検索ページをリロードしなければなりません。 これは4つの単純なHTTPリクエスト要素(検索ページのロード、"A"の検索、 検索ページのロード、"B"の検索)で行うこともできますが、 ここでは、ひとつの子リクエストをテスト中つねに通過するように を使います。 インターリーブコントローラはその子要素の順番は保ちます (例えば、ランダムなので通過しないこともあるがその場所は"覚えている")。 インターリーブされた二つの子要素のリクエストは重複削除されますが、 8または20程度の子リクエストは楽に保つことができます。

Note the that belongs to the Interleave Controller. Imagine that "Search A" and "Search B" share the same PATH info (an HTTP request specification includes domain, port, method, protocol, path, and arguments, plus other optional items). This makes sense - both are search requests, hitting the same back-end search engine (a servlet or cgi-script, let's say). Rather than configure both HTTP Generative Controllers with the same information in their PATH field, we can abstract that information out to a single Configuration Element. When the Interleave Controller "passes on" requests from "Search A" or "Search B", it will fill in the blanks with values from the HTTP default request Configuration Element. So, we leave the PATH field blank for those requests, and put that information into the Configuration Element. In this case, this is a minor benefit at best, but it demonstrates the feature.

は インターリーブコントローラーの一種であることに注意してください。 検索Aと検索Bは同じパス(HTTPリクエストのドメイン、ポート、メソッド、 プロトコル等の詳細)をシェアすると思ってください。 つまり、両方のリクエストとも同じ検索エンジンのバックエンド (サーブレットやCGIスクリプト等)にヒットするということです。 両方のHTTP主コントローラのPATHフィールドに同じことを書いておくより、 ひとつの設定要素に書いておくほうが簡素化できます。 そのため、これらリクエストのPATHフィールドは空白のままにしておき、 その情報は設定要素に書いておきます。 このケースでは大した恩恵を受けるものではありませんが、 特徴をデモするものとして使用しています。

The next element in the tree is another HTTP default request, this time added to the Thread Group itself. The Thread Group has a built-in Logic Controller, and thus, it uses this Configuration Element exactly as described above. It fills in the blanks of any Request that passes through. It is extremely useful in web testing to leave the DOMAIN field blank in all your HTTP Generative Controller elements, and instead, put that information into an HTTP default request element, added to the Thread Group. By doing so, you can test your application on a different server simply by changing one field in your Test Plan. Otherwise, you'd have to edit each and every Generative Controller.

ツリー上の次の要素は別なHTTPリクエスト設定です。 この場合はスレッドグループ自身の設定要素として追加されています。 スレッドグループはビルトインのロジックコントローラを持っていて、 この設定要素は上のように厳密に定義されています。 通過するあらゆるリクエストのブランクを埋めます。 HTTP主コントローラ要素のドメインの設定はブランクにしておき、 そのかわり、スレッドグループに追加したHTTPリクエスト設定にその情報を欠いておきます これによって、テストプラン上のひとつのフィールドを変更するだけで、 違うサーバー上のアプリケーションに対しテストプランを実行することができます。

The last element is a . A Cookie Manager should be added to all web tests - otherwise JMeter will ignore cookies. By adding it at the Thread Group level, we ensure that all HTTP requests will share the same cookies.

最後の要素はです。 クッキーマネージャは全てのテスト上で追加することができます。 設定されていなければJMeterはクッキーを無視します。 スレッドグループのレベルでクッキーマネージャを設定すると、 全てのHTTPリクエストで同じクッキーがシェアされます。

Logic Controllers can be combined to achieve various results. See the list of built-in Logic Controllers.

ロジックコントローラーは様々な結果を導き出します。 built-in Logic Controllersのリストを参照してください。

4.3 Listeners リスナー

Listeners provide access to the information JMeter gathers about the test cases while JMeter runs. The simplest listener, the listener plots the response times on a graph. Listeners usually provide a graphical view of the data that JMeter generates.

リスナーによって実行中のテストについてJMeterが収集している情報にアクセスすることができます。 最もシンプルなリスナーであるは グラフ上にレスポンス時間をプロットします。 リスナーはJMeterが生成するデータをグラフィカルな形で提供します。

An exception to this is the , which, as you might expect, logs the result data to a file.

は例外で、結果データをファイルに記録します。

Listeners can only be added to a Thread Group, and they only collect information specific to that Thread Group. If you have 3 Thread Groups and a listener attached to each one, those three listeners will show three different sets of data.

リスナーはスレッドグループにのみ追加可能で、 そのフレッドグループ内の情報だけを収集します。 もし3つのスレッドグループがあってそれぞれにリスナーがある場合、 3つのリスナーが提示するデータセットはそれぞれ違います。

There are several interesting listeners that come with JMeter.

JMeterには興味深いリスナーがいくつか搭載されています。

4.4 Timers

By default, a JMeter thread sends requests without pausing between each request. We recommend that you specify a delay by adding one of the three timers to your Thread Group. If you do not add a delay, JMeter could overwhelm your server by making too many requests in a very short amount of time.

デフォルトでは、JMeterのスレッドは他のリクエストの休止を待たずにリクエストを送信します。 3つのスレッドグループのタイマーのうちのひとつには遅延をセットしておくことをお勧めします。 もしも遅延をセットしないと、JMeterは過大すぎる数のリクエストを短時間にサーバーに送信 してしまい、サーバーをパンクさせてしまうでしょう。

The timer will cause JMeter to delay a certain amount of time between each request that a thread makes. Remember, threads are independent of one another, and this applies to the timer delay as well.

タイマーはスレッドが生成する各リクエストについていくらかの時間の遅延を発生させます。 スレッドは他のスレッドからは互いに独立しているのでことが、 タイマーによる遅延の発生を可能にしています。

If you choose to add more than one timer to a Thread Group, JMeter takes the sum of the timers and pauses for that amount of time.

スレッドグループに二つ以上のタイマーを追加した場合、 JMeterはそれらのタイマーの値の合計値を計算しそのぶんだけの遅延を発生させます。

4.5 Assertions

Assertions allow you to assert facts about responses received from the server being tested. Using an assertion, you can essentially "test" that your application is returning the results you expect it to.

アサーションによってテスト対象のサーバーが返すレスポンスの内容を検証できます。 アサーションを使うことによってアプリケーションが返す結果が 期待する内容と同じであるかを本当の意味で"テスト"することができます。

For instance, you can assert that the response to a query will contain some particular text. The text you specify can be a Perl-style regular expression, and you can indicate that the response is to contain the text, or that it should match the whole response.

例えば、レスポンスされてきたクエリーの結果が特定のテキストを含んでいるかどうかを検証できます。 そのテキストはPerl風の正規表現で表記できるので レスポンスがそのテキストを含んでいるかどうか、 あるいはレスポンスの全てをそのテキストにマッチさせるのかどうかを表現することができます。

You can add an assertion to any Generative Controller. For example, you can add an assertion to a HTTP Request that checks for the text, "</HTML>". JMeter will then check that the text is present in the HTTP response. If JMeter cannot find the text, then it will mark this as a failed request.

主コントローラにはどれでもアサーションを追加することができます。 例えば、HTTPリクエストで"</HTML>"があるかどうかチェックするアサーションを追加できます。 JMeterはHTTPレスポンスにそのテキストが入っているかどうかをチェックします。 もしそのテキストが入っていなければ、そのリクエストは失敗としてマークします。

To view the assertion results, add an Assertion Listener to the Thread Group.

アサーションの結果を見るにはアサーションリスナーをスレッドグループに追加してください。

4.6 Configuration Elements 設定要素

A configuration element works closely with a Generative Controller. Although it does not send requests (except for ), it can add to or modify requests.

設定要素は主コントローラに近い形で動作します。 それ自体はリクエストを送信しない(を除く)にかかわらず、 リクエストを追加したり変更したりすることができます。

A configuration element is accessible from only inside the tree branch where you place the element. For example, if you place an HTTP Cookie Manager inside a Simple Logic Controller, the Cookie Manager will only be accessible to HTTP Request Controllers you place inside the Simple Logic Controller (see figure 1). The Cookie Manager is accessible to the HTTP requests "Web Page 1" and "Web Page 2", but not "Web Page 3".

要素をセットしたツリーの枝においてのみ設定要素にアクセスできます。 例えば、シンプルロジックコントローラーにHTTPクッキーマネージャを置いた場合は、 クッキーマネージャはそのシンプルロジックコントローラーの中に置いたHTTPリクエストコントローラにのみアクセスできます(figure1を参照)。 クッキーマネージャは"Web Page 1"と"Web Page 2"のHTTPリクエストにはアクセスできますが"Web Page 3"にはアクセスできません。

Also, a configuration element inside a tree branch has higher precedence than the same element in a "parent" branch. For example, we defined two HTTP Request Defaults elements, "Web Defaults 1" and "Web Defaults 2". Since we placed "Web Defaults 1" inside a Loop Controller, only "Web Page 2" can access it. The other HTTP requests will use "Web Defaults 2", since we placed it in the Thread Group (the "parent" of all other branches).

ツリーの枝の中にある設定要素はその親ツリーの同じ要素よりも優先されます。 例えば、HTTPリクエストの設定要素を"Web Defaults 1" と "Web Defaults 2"として定義したとしましょう。 "Web Defaults 1"をループコントローラー内に置いたので、 "Web Defaults 2"だけがそれにアクセスできます。 他のHTTPリクエストは、スレッドグループ(他の全てのブランチの"親")に置かれた"Web Defaults 2"を使用します。

Figure 1 - Test Plan Showing Accessability of Configuration Elements

Copyright © 1999-2001, Apache Software Foundation