パスワードを忘れた? アカウント作成
459838 journal

bananan_wの日記: 英語勉強日記(翻訳がんばろう日記)

日記 by bananan_w
というわけで、懸案事項である、英語ドキュメント読解能力を高めるために、
技術文書の翻訳をやってみよう。対象はJMeterのドキュメントで気になるところから。

http://jakarta.apache.org/jmeter/usermanual/functions.html

  19. Functions and Variables
19. 関数と変数

        JMeter functions are special values that can populate fields of any Sampler or other element in a test tree. A function call looks like this:
JMeterの関数は特別なものです。テストツリー上のサンプラーやその他の要素のフィールドに値を設定することができます。関数は以下のようにして使用します。

        ${__functionName(var1,var2,var3)}

        Where "__functionName" matches the name of a function.
        Parentheses surround the parameters sent to the function, for example ${__time(YMD)} The actual parameters vary from function to function. Functions that require no parameters can leave off the parentheses, for example ${__threadNum}.
    "__functionName"は関数名を指定します。
    丸括弧で囲んだ部分は、関数へ与えるパラメータを指定します。例えば、${__time(YMD)}は実際のパラメータは関数内部で決定します。パラメータを要求しない関数は、丸括弧を必要としません。例として、${__threadNum}があります。

        If a function parameter contains a comma, then be sure to escape this with "\", otherwise JMeter will treat it as a parameter delimiter. For example:
    関数のパラメータにカンマが含まれる場合には、"\"でエスケープする必要があります。エスケーブしなければ、JMeterはパラメータをデリミタで分割されたものとして扱います。以下に例をあげます。

${__time(EEE\, d MMM yyyy)}

        Variables are referenced as follows:
    変数は以下のように参照します。

${VARIABLE}

        If an undefined function or variable is referenced, JMeter does not report/log an error - the reference is returned unchanged. For example if UNDEF is not defined as a variable, then the value of ${UNDEF} is ${UNDEF}. Variables, functions (and properties) are all case-sensitive. Versions of JMeter after 2.3.1 trim spaces from variable names before use, so for example ${__Random(1,63, LOTTERY )} will use the variable 'LOTTERY' rather than ' LOTTERY '.
    未定義の関数や変数が参照されたなら、JMeterはレポートやログにエラーを出力しませんし、その参照は変更されません。例として、UNDEFが変数として未定義の場合に、${UNDEF}を参照した場合には、文字列としての${UNDEF}が取得されます。変数、関数(そして所有物(訳注:何それ?))の全ては大文字と小文字を区別します。JMeter 2.3.1 以降では、変数名の前後の余計な空白文字を取り除きます。例として、${__Random(1,63, LOTTERY )}を指定した場合には変数' LOTTERY 'ではなく、'LOTTERY'が指定されたものとみなします。

        Properties are not the same as variables. Variables are local to a thread; properties are common to all threads, and need to be referenced using the __P or __property function.
    属性は変数と同じものではありません。変数はスレッドローカルですが、属性は全てのスレッドで共通であり、__Pもしくは__propertyから始まる名前を付ける必要があります。

        List of functions, loosely grouped into types.
        関数一覧、大雑把に分類した種別

        Type of function Name Comment
        関数の種類 名前 コメント

        Information threadNum get thread number
        情報 threadNum スレッド番号を取得する

        Information machineName get the local machine name
        情報 machineName ローカルのマシン名を取得する

        Information time return current time in various formats
        情報 time 現在時刻を可変形式で取得する

        Information log log (or display) a message (and return the value)
        情報 log メッセージ(かつ、値の取得)をログへ出力(もしくは画面表示を)する

        Information logn log (or display) a message (empty return value)
        情報 logn メッセージをログへ出力(もしくは画面表示)をする。(取得される値は空)

        Input StringFromFile read a line from a file
        入力 StringFromFile ファイルからの行の読み込み

        Input CSVRead read from CSV delimited file
        入力 CSVRead CSV形式ファイルの読み込み

        Input XPath Use an XPath expression to read from a file
        入力 XZPath XPath形式ファイルの読み込み

        Calculation counter generate an incrementing number
        計算 counter インクリメンタルな数字を生成する

        Calculation intSum add int numbers
        計算 intSum int型の数値を加える

        Calculation longSum add long numbers
        計算 longSum long型の数値を加える

        Calculation Random generate a random number
        計算 Random 乱数値を生成する

        Calculation regexFunction parse previous response using a regular expression
        計算 regexFunction レスポンスを解析する前に正規表現を使用する

        Scripting BeanShell run a BeanShell script
        スクリプト BeanShell BeanShellスクリプトを実行する

        Scripting javaScript process JavaScript (Mozilla Rhino)
        スクリプト javaScript JavaScriptを実行する(Mozilla Rhino)

        Scripting jexl evaluate a Commons Jexl expression
        スクリプト jexl JEXL表現の評価

        Properties property read a property
        プロパティ property プロパティの読み込み

        Properties P read a property (shorthand method)
        プロパティ P プロパティの読み込み(略記)

        Properties setProperty set a JMeter property
        プロパティ setProperty JMeterプロパティの設定

        Variables split Split a string into variables
        変数 split 文字列を分割し変数へ代入する

        Variables V evaluate a variable name
        変数 V 変数の評価

        Variables eval evaluate a variable expression
        変数 eval 変数表現の評価(要見直し)

        Variables evalVar evaluate an expression stored in a variable
        変数 evalVar 変数に保存された式を評価する

        19.1 What can functions do
        19.1 関数では何ができるか

                There are two kinds of functions: user-defined static values (or variables), and built-in functions.
                User-defined static values allow the user to define variables to be replaced with their static value when a test tree is compiled and submitted to be run. This replacement happens once at the beginning of the test run. This could be used to replace the DOMAIN field of all HTTP requests, for example - making it a simple matter to change a test to target a different server with the same test.
ユーザ定義の静的な値(もしくは変数)と、組み込みの関数の二種類の関数が存在します。
ユーザ定義の静的な値は、テストツリーがコンパイルされて動作を始める時に、ユーザが定義した静的な変数で置換されます。この置換動作はテストが動作を開始する時に一度だけ行なわれます。HTTPリクエストのドメインフィールドの置換に使用します。例として、同じテストを用いて異なるサーバへのテストの実施を簡単なものにしてくれます。

                Note that variables cannot currently be nested; i.e ${Var${N}} does not work. The __V (variable) function (versions after 2.2) can be used to do this: ${__V(Var${N})}. In earlier JMeter versions one can use ${__BeanShell(vars.get("Var${N}")}.
        注釈:変数はネストすることができません。例として、${Var${N}} は期待通りに動作しません。__V(varieble)関数であれば(version 2.2以降)次のように記述することで動作します${__V(Var${N})}。それより前のバージョンのJMeterであれば、${__BeanShell(vars.get("Var${N}")}と記述することで動作します。

                This type of replacement is possible without functions, but was less convenient and less intuitive. It required users to create default config elements that would fill in blank values of Samplers. Variables allow one to replace only part of any given value, not just filling in blank values.
        これらの置換は関数を使用することなく実施することができますが、それほど便利ではないしわかりやすくもありません。ユーザに対して、サンプラー上に新規の設定項目を作成することを要求しています。変数は与えられた値を部分的に置換することができますが、空白の値は代入することができません。

                With built-in functions users can compute new values at run-time based on previous response data, which thread the function is in, the time, and many other sources. These values are generated fresh for every request throughout the course of the test.
        レスポンスデータを得るたび、スレッド上で関数が呼び出されるたび、その他の要求が起きるたびに、新しく計算した値を組み込みの関数ではユーザが得ることができます。この値はテストリクエストの動作が進行するたびに新しく生成されます。

                Functions are shared between threads. Each occurrence of a function call in a test plan is handled by a separate function instance.
        関数はスレッド間で共有されます。テスト計画からのそれぞれの関数呼び出しは、別々の関数インスタンスによって扱われます。

  19.2 Where can functions and variables be used?
  19.2 関数と変数はどこで使用できる?

        Functions and variables can be written into any field of any test component (apart from the TestPlan - see below). Some fields do not allow random strings because they are expecting numbers, and thus will not accept a function. However, most fields will allow functions.
        関数と変数はテスト計画上のどこのフィールドにも記述することができます(TestPlan以下を見ることを別として(訳注:後でここ見直す事))。いくつかのフィールドでは乱数値を使用する事はできません。それらは、関数の使用を許可しておらず、数値のみを許可しているからです。しかし、大多数のフィールドでは関数を使用する事ができます。

        Functions which are used on the Test Plan have some restrictions. JMeter thread variables will have not been fully set up when the functions are processed, so variable names passed as parameters will not be set up, and variable references will not work, so split() and regex() and the variable evaluation functions won't work. The threadNum() function won't work (and does not make sense at test plan level). The following functions should work OK on the test plan:
        テスト計画上の関数にはいくつかの制限があります。JMeterスレッドにおいて、関数が完全に終わっていない場合には、変数は機能しません。引数によって確定する変数名が確定していない場合や、変数の参照が機能しない場合や、split()やregex()や変数を評価する関数は機能しません。threadNum()関数は動作しません(テスト計画レベルでは)。以下の関数はテスト計画においても動作します。

                * intSum
                * longSum
                * machineName
                * BeanShell
                * javaScript
                * jexl
                * random
                * time
                * property functions
                * log functions

        Configuration elements are processed by a separate thread. Therefore functions such as __threadNum do not work properly in elements such as User Defined Variables. Also note that variables defined in a UDV element are not available until the element has been processed.
        設定項目はスレッド毎に独立しています。したがって、__threadNumなどはユーザ定義変数の中では適切に動作しません。また、UDV(訳注:ユーザ定義変数の事か?)は要素が処理されるまで有効になりません。

        When using variable/function references in SQL code (etc), remember to include any necessary quotes for text strings, i.e. use
        SQL文やその他で変数や関数を参照する場合、テキスト文字列はクォートする必要がある事を覚えていて下さい。例:以下の様に使用します

        SELECT item from table where name='${VAR}'
        not
        以下の指定は誤りです。
        SELECT item from table where name=${VAR}
        (unless VAR itself contains the quotes)
        (VAR変数内にクォートが含まれていない場合には)

  19.3 How to reference variables and functions
  19.3 変数と関数の参照方法

        Referencing a variable in a test element is done by bracketing the variable name with '${' and '}'.
        変数名を '${' と '}' で囲むことで、変数をテストから参照することができます。

        Functions are referenced in the same manner, but by convention, the names of functions begin with "__" to avoid conflict with user value names * . Some functions take arguments to configure them, and these go in parentheses, comma-delimited. If the function takes no arguments, the parentheses can be omitted.
        同様の方法で関数の参照も行なうことができます。しかし、ユーザが使用する変数名との競合を避けるために、しきたりとして関数名は先頭文字列が"__"から始まります。いくつかの関数は設定を行なうために引数を取るものがあります。引数は丸括弧で括ったカンマ区切りで指定します。関数が引数を取らない場合には、丸括弧を省略することができます。

        Argument values that themselves contain commas should be escaped as necessary. If you need to include a comma in your parameter value, escape it like so: '\,'. This applies for example to the scripting functions - Javascript, Beanshell, Jexl - where it is necessary to escape any commas that may be needed in script method calls - e.g.
        引数の中の値にカンマを含める場合には、必要に応じてエスケープする必要があります。設定値自身にカンマを含める場合には、'\,'の様にエスケープします。これは例えば、スクリプト関数で適用します。Javascript、Beanshell、Jexlこれらではスクリプトによるメソッドの呼び出しにおいて、カンマをエスケープする必要があります。以下に例をあげます。

        ${__BeanShell(vars.put("name"\,"value"))}

        Functions can reference variables and other functions, for example ${__XPath(${__P(xpath.file),${XPATH})} will use the property "xpath.file" as the file name and the contents of the variable XPATH as the expression to search for.
        関数では変数を参照することと、他の関数を実行することができます。例えば、${__XPath(${__P(xpath.file),${XPATH})}はプロパティ"xpath.file"をファイル名として、変数XPATHを検索対象の拡張表現として指定しています。

        JMeter provides a tool to help you construct function calls for various built-in functions, which you can then copy-paste. It will not automatically escape values for you, since functions can be parameters to other functions, and you should only escape values you intend as literal.
        JMeterにはさまざまな組み込み関数が存在し、あなたが関数呼び出しを組み立てるための手助けをしてくれるツールを提供します。それらはコピー&ペーストして使うことができます。それらは他の関数の設定値とされているかも知れないので、自動で値をエスケープすることはありません。あなたはリテラルであることを期待している値だけをエスケープすべきです。

        The value of a variable or function can be reported using the __logn() function. The __logn() function reference can be used anywhere in the test plan after the variable has been defined. Alternatively, the Java Request sampler can be used to create a sample containing variable references; the output will be shown in the appropriate Listener. For versions of JMeter later than 2.3, there is a Debug Sampler that can be used to display the values of variables etc in the Tree View Listener.
        __login()関数を用いて変数と関数の値を確認することができます。__login()関数による確認は変数が定義された後であれば、テスト計画のどこでも使用できます。あるいは、Java Requestサンプラーは変数の参照を含むサンプル(訳注:???サンプラーの事?)を作成できます。出力は適切なリスナによって参照されます。JMeterバージョン2.3以降では、デバッグサンプラーのツリービューサンプラーによって変数の値を確認する事ができます。

        * If you define a user-defined static variable with the same name as a built-in function, your static variable will override the built-in function.
        * ユーザの静的な変数定義が組み込み関数と同名である場合には、ユーザの静的な変数定義は組み込み関数より優先されます。

  19.4 The Function Helper Dialog
  19.4 関数ヘルパーダイアログ

        The Function Helper dialog is available from JMeter's Tools menu.
        関数ヘルパーダイアログはJMeterのツールメニューから実行します。

        Function Helper Dialog
        関数ヘルパーダイアログ

        Using the Function Helper, you can select a function from the pull down, and assign values for its arguments. The left column in the table provides a brief description of the argument, and the right column is where you write in the value for that argument. Different functions take different arguments.
        関数ヘルパーを使用する事で、プルダウンから関数を選択して引数の値を指定する事ができます。テーブルの左側のカラムには引数の簡単な説明文が表示されます。右側のカラムにはその引数に設定する値を指定します。それぞれの関数は、それぞれ異なる引数を取ります。

        Once you have done this, click the "generate" button, and the appropriate string is generated for you to copy-paste into your test plan wherever you like.
        これを行なった後で、"生成"ボタンを押下すると、あなたがテスト計画の好きな場所にコピー&ペーストできる文字列を生成します。

  19.5 Functions
  19.5 関数

        19.5.1 __regexFunction
        19.5.1 __regexFunction

        The Regex Function is used to parse the previous response (or the value of a variable) using any regular expression (provided by user). The function returns the template string with variable values filled in.
        正規表現関数は任意の正規表現(ユーザ定義による)を用いて、直前の応答(もしくは変数の値)のパースを行ないます。変数フィールドを用いて、関数は戻り値を返却します。

        The __regexFunction can also store values for future use. In the sixth parameter, you can specify a reference name. After this function executes, the same values can be retrieved at later times using the syntax for user-defined values. For instance, if you enter "refName" as the sixth parameter you will be able to use:
        __regexFunctionは将来的に使用する値を保持することができます。6番目の引数によって、参照名を指定することができます。この関数を実行した後で同じ値を後から参照するためには、ユーザ定義による参照名に構文(訳注:後で見直す)をあてはめます。例として、6番目の引数に"refName"を指定した場合には、以下の様に参照することができます。

                * ${refName} to refer to the computed result of the second parameter ("Template for the replacement string") parsed by this function
                * ${refName} は2番目の引数("文字列を置換するためのテンプレート")のパースを行なった結果を参照します。

                * ${refName_g0} to refer to the entire match parsed by this function.
                * ${refName_g0} は正規表現がマッチした全てのグループを参照します。(訳注:後で確認すること)

                * ${refName_g1} to refer to the first group parsed by this function.
                * ${refName_g1} は正規表現が一番最初にマッチしたグループを参照します。

                * ${refName_g#} to refer to the n th group parsed by this function.
                * ${refName_g#} は正規表現がn番目にマッチしたグループを参照します。

                * ${refName_matchNr} to refer to the number of groups found by this function.
                * ${refName_matchNr} は正規表現でマッチしたグループの数を参照します。

        Parameters
        Attribute Description Required
        First argument The first argument is the regular expression to be applied to the response data. It will grab all matches. Any parts of this expression that you wish to use in your template string, be sure to surround in parentheses. Example: <a href="(.*)">. This will grab the value of the link and store it as the first group (there is only 1 group). Another example: <input type="hidden" name="(.*)" value="(.*)">. This will grab the name as the first group, and the value as the second group. These values can be used in your template string Yes
        第一引数 第一引数は直前の応答に適用する正規表現です。欲張りなマッチです。この正規表現は任意の部分をテンプレート文字列に含めることができますが、それを行なうには必ず丸括弧で括ってください。例:<a href="(.*)">この場合には、リンクを欲張りにマッチさせ、1番目のグループに格納します(合計1グループです)。他の例:<input type="hidden" name="(.*) value="(.*)">この場合には、欲張りにマッチを行ないnameを1番目のグループとし、valueを2番目のグループとします。これらの値はテンプレート文字列として使用することができます。 必須

        Second argument This is the template string that will replace the function at run-time. To refer to a group captured in the regular expression, use the syntax: $[group_number]$. Ie: $1$, or $2$. Your template can be any string. Yes
        第二引数 テンプレート文字列は関数実行時に置換を行ないます。正規表現中で得られたグループは以下の文法で参照します。例:$1$や$2$。テンプレートには任意の文字列を入力することができます。 必須

        Third argument The third argument tells JMeter which match to use. Your regular expression might find numerous matches. You have four choices:
        第三引数 3番目の引数はJMeterが何にマッチをするかの指定するために使用します。正規表現はおびただしい量のマッチを見つけるかもしれません。4つの選択肢があります。

                * An integer - Tells JMeter to use that match. '1' for the first found match, '2' for the second, and so on
                * 整数値 - どのマッチを使用するかJMeterに指定します。'1'であるなら1番目のマッチ、'2'であるなら2番目のマッチ等。

                * RAND - Tells JMeter to choose a match at random.
                * RAND - ランダムにマッチを選択するようJMeterに指定します。

                * ALL - Tells JMeter to use all matches, and create a template string for each one and then append them all together. This option is little used.
                * ALL - 全てのマッチを使用するようにJMeterに指定します。マッチした全てに対しテンプレート文字列を生成し、生成した全てを追加します。このオプションはあまり用いられません。(訳注:後で見直し)
                * A float number between 0 and 1 - tells JMeter to find the Xth match using the formula: (number_of_matches_found * float_number) rounded to nearest integer.
                * 0〜1の間の浮動小数値 - 次の計算式にしたがってX番目のマッチを使用するようにJMeterに指定します。(マッチ発見個数 * 浮動小数点値)計算結果は最も近い整数に丸められます。

                No, default=1
                省略可、default=1

        Fourth argument If 'ALL' was selected for the above argument value, then this argument will be inserted between each appended copy of the template value. No
        第四引数 第三引数に'ALL'が指定された場合には、それぞれにテンプレートを挿入した間にこの引数を追加します。 省略可

        Fifth argument Default value returned if no match is found No
        第五引数 マッチが見つからなかった場合のデフォルト値 省略可

        Sixth argument A reference name for reusing the values parsed by this function.
        第六引数 正規表現によってマッチした部分を参照するための名前です。

        Stored values are ${refName} (the replacement template string) and ${refName_g#} where "#" is the group number from the regular expression ("0" can be used to refer to the entire match). No
        (テンプレート文字列による置換実施後に)格納された文字列を${refName}によって参照できます。${refName_g#}"#"には正規表現のグループ番号を指定します("0"はマッチした全てに一致します)。 省略可

        Seventh argument Input variable name. If specified, then the value of the variable is used as the input instead of using the previous sample result. No
        第七引数 入力変数。指定された場合は、直前の応答の代わりにこの変数を使用します。 省略可

19.5.2 __counter
19.5.2 __counter

The counter generates a new number each time it is called, starting with 1 and incrementing by +1 each time. The counter can be configured to keep each simulated user's values separate, or to use the same counter for all users. If each user's values is incremented separately, that is like counting the number of iterations through the test plan. A global counter is like counting how many times that request was run.
カウンタは呼び出されるたびに新しい数値を生成します。1から開始して+1ずつ毎回加算します。カウンタはそれぞれのシミュレートするユーザの値を別々に保持することや、全てのユーザに同じ値を使用させることができます。それぞれのユーザの数値を独立して加算する場合には、テスト計画の仮定の数を繰返し数えるようなものです(訳注:変。修正すること)。グローバルカウンタはリクエストが何度実行されたかを数えるようなものです。

The counter uses an integer variable to hold the count, which therefore has a maximum of 2,147,483,647.
カウンタを保持するために、整数値の変数を使用します。従って、最大値は2,147,483,647です。

The counter function instances are now completely independent. [JMeter 2.1.1 and earlier used a fixed thread variable to keep track of the per-user count, so multiple counter functions operated on the same value.] The global counter - "FALSE" - is separately maintained by each counter instance.
カウンタ関数は現在、完全に独立しています。[JMeter 2.1.1 以前では、ユーザ毎のカウントを保持するため、修正したスレッド変数を使用していました。そのため、複数のカウンタ関数を実行すると同じ値となっていました。]グローバルカウンタ -"FALASE"- はそれぞれのカウンタインスタンスが分離した状態を維持します。

Parameters
Attribute Description Required
First argument TRUE if you wish each simulated user's counter to be kept independent and separate from the other users. FALSE for a global counter. Yes
第一引数 他のユーザから独立し、分離されたカウンタをユーザに保持させる場合にはTRUEを指定します。FALSEを指定するとグローバルカウンタとなります。 必須

Second argument A reference name for reusing the value created by this function.
Stored values are of the form ${refName}. This allows you to keep one counter and refer to its value in multiple places. [For JMeter 2.1.1 and earlier this parameter was required.] No
第二引数 この関数によって作られた値を再利用するための参照名。一つのカウンタを複数箇所から参照することを許可します。[JMeter 2.1.1 以前ではこの引数は必須でした。] 省略可

19.5.3 __threadNum
19.5.3 __threadNum

The thread number function simply returns the number of the thread currently being executed. These numbers are independent of ThreadGroup, meaning thread #1 in one threadgroup is indistinguishable from thread #1 in another threadgroup, from the point of view of this function.
スレッド番号関数は単に、現在実行中のスレッド番号を返却します。この番号はスレッドグループ内で独立しています。つまりこの関数の特徴によって、あるスレッドグループのスレッド番号#1と他のスレッドグループのスレッド番号#1は見分けがつきません。

There are no arguments for this function.
この関数は引数をとりません。

This function does not work in any Configuration elements (e.g. User Defined Variables) as these are run from a separate thread. Nor does it make sense to use it on the Test Plan.
この関数はスレッドが分断されるいくつかの設定要素では使用できません(ユーザ定義変数等)。また、それをテスト計画で使用する価値はありません。

19.5.4a __intSum
19.5.4a __intSum

The intSum function can be used to compute the sum of two or more integer values.
intSum関数は二つ以上のint値の合計を計算するために使用できます。

JMeter Versions 2.3.1 and earlier required the reference name to be present. The reference name is now optional, but it must not be a valid integer.
JMeter version 2.3.1 より前では参照名が必要でした。現在では参照名はオプションです。しかし、それは有効なint値であってはいけません。

Parameters
Attribute Description Required
First argument The first int value. Yes
第一引数 1番目のint値 必須

Second argument The second int value. Yes
第二引数 2番目のint値 必須

nth argument The nth int value. No
第n引数 n番目のint値 省略可

last argument A reference name for reusing the value computed by this function. If specified, the reference name must contain at least one non-numeric character otherwise it will be treated as another int value to be added. No
最終引数 この関数で計算した値を再利用するための参照名。指定する場合には参照名は少なくとも一文字の非数字の文字を
含めなくてはなりません。含めないなら、加算するためのint値として扱われるでしょう。 省略可

19.5.4b __longSum
19.5.4b __longSum

The longSum function can be used to compute the sum of two or more long values.
longSum関数は二つ以上のlong値の合計を計算するために使用できます。

Parameters
Attribute Description Required
First argument The first long value. Yes
第一引数 1番目のlong値 必須

Second argument The second long value. Yes
第二引数 2番目のlong値 必須

nth argument The nth long value. No
第n引数 n番目のlong値 省略可

last argument A reference name for reusing the value computed by this function. If specified, the reference name must contain at least one non-numeric character otherwise it will be treated as another long value to be added. No
最終引数 この関数で計算した値を再利用するための参照名。指定する場合には参照名は少なくとも一文字の非数字の文字を
含めなくてはなりません。含めないなら、加算するためのlong値として扱われるでしょう。 省略可

19.5.5 __StringFromFile
19.5.5 __StringFromFile

The StringFromFile function can be used to read strings from a text file. This is useful for running tests that require lots of variable data. For example when testing a banking application, 100s or 1000s of different account numbers might be required.
StringFromFile関数はテキストファイルから文字列を読み込むために使用できます。テストで大量の可変データが必要な場合に大変有効です。例として、銀行アプリケーションをテストする場合に、100か1000のことなるアカウント番号が必要な場合です。

See also the CSV Data Set Config test element which may be easier to use. However, that does not currently support multiple input files.
単純に使用するためにはCSV Data Set Config test element(訳注:ここはAタグなので翻訳先と併せること)を参照してください。しかし、現在は複数のファイルによる入力をサポートしていません。

Each time it is called it reads the next line from the file. When the end of the file is reached, it will start reading again from the beginning, unless the maximum loop count has been reached. If there are multiple references to the function in a test script, each will open the file independently, even if the file names are the same. [If the value is to be used again elsewhere, use different variable names for each function call.]
関数が呼ばれるたびにファイルの次の行を読み込みます。ファイルの終端に到達すると、ファイルの先頭から再び読み込みを行ないます。ループ回数の最大値に到達するまで繰返し行なわれます。テストスクリプト中の複数個所で実行された場合、それぞれが独立して同名のファイルを開きます。[他の場所で読みとった値を再利用する場合には、それぞれの関数呼出において異なる名前の参照名を使用します。]

If an error occurs opening or reading the file, then the function returns the string "**ERR**"
オープンまたは読み込みでエラーが発生した場合には、関数は"**ERR**""を取得します。

Parameters
Attribute Description Required
File Name Path to the file name. (The path can be relative to the JMeter launch directory) If using optional sequence numbers, the path name should be suitable for passing to DecimalFormat. See below for examples. Yes
ファイル名 ファイルパス(JMeterを起動させたディレクトリからの相対パス)。オプションにシーケンス番号を指定する場合には、パス名はDecimalFormat形式に則らなければならない。後に例を記述します。 必須

Variable Name A reference name - refName - for reusing the value created by this function. Stored values are of the form ${refName}. Defaults to "StringFromFile_". No
変数名 参照名 - refName - をこの関数で作成し、値を再利用できます。読み込まれた値は${refName}と参照します。デフォルトは"StringFromFile_"です。 省略可

Start sequence number Initial Sequence number (if omitted, the End sequence number is treated as a loop count) No
開始シーケンス番号 シーケンス番号初期値(省略した場合、終了シーケンス番号をループカウントとみなします。) 省略可

End sequence number Final sequence number (if omitted, seqence numbers can increase without limit) No
終了シーケンス番号 シーケンス番号終了値(省略した場合、シーケンス番号は無制限となります。) 省略可

The file name parameter is resolved when the file is opened or re-opened.
ファイルをオープンする時か再オープンする時に、ファイル名パラメータは解決されます。

The reference name parameter (if supplied) is resolved every time the function is executed.
関数が実行されるたびに参照名パラメータの値は(使用しているなら)変化します。

Using sequence numbers:
シーケンス番号の使用方法:

When using the optional sequence numbers, the path name is used as the format string for java.text.DecimalFormat. The current sequence number is passed in as the only parameter. If the optional start number is not specified, the path name is used as is. Useful formatting sequences are:
オプションのシーケンス番号を使用する場合には、パス名にjava.text.DecimalFormat形式の文字列を使わなくてはならない。現在のシーケンス番号が唯一のパラメータとして使用されます。オプションのシーケンス開始番号がセットされていない場合には、パス名はそのまま使用されます。便利なシーケンスのフォーマットは以下の通りです。

# - insert the number, with no leading zeros or spaces
# - ゼロパディングや空白文字無しで数字を挿入します。

000 - insert the number packed out to 3 digits with leading zeros if necessary
000 - 3桁の数字をゼロパディングありで挿入します。

Examples:
例:
pin#'.'dat -> pin1.dat, ... pin9.dat, pin10.dat, ... pin9999.dat
pin000'.'dat -> pin001.dat ... pin099.dat ... pin999.dat ... pin9999.dat
pin'.'dat# -> pin.dat1, ... pin.dat9 ... pin.dat999

If more digits are required than there are formatting characters, the number will be expanded as necessary.
To prevent a formatting character from being interpreted, enclose it in single quotes. Note that "." is a formatting character, and must be enclosed in single quotes (though #. and 000. work as expected in locales where the decimal point is also ".")
フォーマット用文字が解析されることを避けるために、シングルクォートで括ってください。注意:上記例の"."はフォーマット文字であるので、シングルクォートで括る必要があります(たとえ小数点が"."であるロケールにおいて #. と 000. が期待した通りに動いたとしても)。

In other locales (e.g. fr), the decimal point is "," - which means that "#." becomes "nnn,".
他のロケール(例:fr)では小数点は","です。これはつまり"#."は"nnn,"を意味することになります。

See the documentation for DecimalFormat for full details.
詳細についてはDecimalFormatの文書を参照してください。

If the path name does not contain any special formatting characters, the current sequence number will be appended to the name, otherwise the number will be inserted aaccording to the fomatting instructions.
パス名に特別なフォーマットの文字が含まれていない場合には、現在のシーケンス番号が名前に付けられます。それ以外の場合には、
フォーマット文字列の指示通りに番号が付けられます。

If the start sequence number is omitted, and the end sequence number is specified, the sequence number is interpreted as a loop count, and the file will be used at most "end" times. In this case the filename is not formatted.
開始シーケンス番号が省略され、終了シーケンス番号が指定されている場合には、ファイルの終端まで到達した回数のループカウンタとしてシーケンス番号を解釈します。この場合にはファイル名の番号付けは行なわれません。

${_StringFromFile(PIN#'.'DAT,,1,2)} - reads PIN1.DAT, PIN2.DAT
${_StringFromFile(PIN#'.'DAT,,1,2)} - PIN1.DAT と PIN2.DAT を読み込みます

${_StringFromFile(PIN.DAT,,,2)} - reads PIN.DAT twice
${_StringFromFile(PIN.DAT,,,2)} - reads PIN.DAT を2回読み込みます

Note that the "." in PIN.DAT above should not be quoted. In this case the start number is omitted, so the file name is used exactly as is.
注意:PIN.DATの"."はクォートする必要がありません。この場合には開始シーケンス番号を省略しているため、ファイル名はまさにそのまま使用されます。

19.5.6 __machineName
19.5.6 __machineName

The machineName function returns the local host name
machineName関数はローカルホストの名前を返却します。

Parameters
Attribute Description Required
Variable Name A reference name for reusing the value computed by this function. No
変数名 この関数で得られた値を再利用するための参照名。 必須

19.5.7 __javaScript
19.5.7 __javaScript

The javaScript function executes a piece of JavaScript (not Java!) code and returns its value
javaScript関数はJavaScript(Javaではない!)のかけらを実行した結果を得るために使用します。

The JMeter Javascript function calls a standalone JavaScript interpreter. Javascript is used as a scripting language, so you can do calculations etc.
JMeterのJavascript関数はスタンドアロンのJavaScriptインタラプタによって呼び出されます。JavaScriptはスクリプト言語として実行され、計算を行なうことができます。

For details of the language, please see Mozilla Rhino Overview
この言語の詳細については、Mozilla Rhinoのあらましを参照してください。

The following variables are made available to the script:
スクリプトは以下の変数を作成します。

        * ctx - JMeterContext object
        * ctx - JMeterコンテキストオブジェクト

        * vars - JMeterVariables object
        * vars - JMeter変数オブジェクト

        * threadName - String
        * threadName - 文字列

        * sampler - current Sampler object (if any)
        * sampler - 現在のサンプラーオブジェクト(存在するなら)

        * sampleResult - previous SampleResult object (if any)
        * sampleResult - 直前のサンプラーの応答オブジェクト(存在するなら)

        * props - JMeter Properties object
        * props - JMeterプロパティオブジェクト

JMeter is not a browser, and does not interpret the JavaScript in downloaded pages.
JMeterはブラウザではないので、ダウンロードしたページと対応するJavaScriptを実行することはできません。

Parameters
Attribute Description Required
Expression The JavaScript expression to be executed. For example:
評価式 実行するJavaScript式。例:

        * new Date() - return the current date and time
        * new Date() - 現在の日付と時刻を得る

        * Math.floor(Math.random()*(${maxRandom}+1)) - a random number between 0 and the variable maxRandom
        * Math.floor(Math.random()*(${maxRandom}+1)) - 0〜変数maxRandomまでの間の乱数を得る

        * ${minRandom}+Math.floor(Math.random()*(${maxRandom}-${minRandom}+1)) - a random number between the variables minRandom and maxRandom
        * ${minRandom}+Math.floor(Math.random()*(${maxRandom}-${minRandom}+1)) - 変数minRandom〜maxRandomまでの間の乱数を得る

        * "${VAR}"=="abcd"
        * "${VAR}"=="abcd"

        Yes
                必須

Variable Name A reference name for reusing the value computed by this function. No
変数名 この関数で得られた値を再利用するための参照名。 省略可

Remember to include any necessary quotes for text strings and JMeter variables. Also, if the expression has commas, please make sure to escape them. For example in:
テキスト文字列とJMeter変数のために必要であるクォータを含めることを忘れないでください。JavaScript式にカンマが含まれている場合には、エスケープしてください。例:

${__javaScript('${sp}'.slice(7\,99999))}
the comma after 7 is escaped.
7の次のカンマをエスケープします。

19.5.8 __Random
19.5.8 __Random

The random function returns a random number that lies between the given min and max values.
random関数は与えられた最小値と最大値の間の乱数値を得るために使用します。

Parameters
Attribute Description Required
Minimum value A number Yes
最小値 数値 必須

Maximum value A bigger number Yes
最大値 最小値より大きい数値 必須

Variable Name A reference name for reusing the value computed by this function. No
変数名 この関数で得られた値を再利用するための参照名。 省略可

19.5.8 __CSVRead
19.5.8 __CSVRead

The CSVFile function returns a string from a CSV file (c.f. StringFromFile )
CSVFile関数はCSVファイル(参照:StringFromFile(訳注:Aタグ))から文字列を得るために使用します。

NOTE: versions up to 1.9.1 only supported a single file. JMeter versions since 1.9.1 support multiple file names.
注意:version 1.9.1 より前では一つのファイルしかサポートしていませんでしたが、JMeter verion 1.9.1以降では複数のファイルのサポートをしています。

In most cases, the newer CSV Data Set Config element is easier to use.
多くの場合では、最新のCSV Data Set Config elementを参照すると簡単に使用できます。

When a filename is first encountered, the file is opened and read into an internal array. If a blank line is detected, this is treated as end of file - this allows trailing comments to be used (N.B. this feature was introduced in versions after 1.9.1)
ファイル名に初めて遭遇すると、ファイルはオープンされ内部配列に読み込まれます。空行を発見した場合には、ファイル終端として扱います。これは、コメントが行を跨いで記述することを許可しています。(N.B. version 1.9.1 以降でこの機能を実装しています(訳注:N.B.の意味がわからない。note wellか?))。

All subsequent references to the same file name use the same internal array. N.B. the filename case is significant to the function, even if the OS doesn't care, so CSVRead(abc.txt,0) and CSVRead(aBc.txt,0) would refer to different internal arrays.
同じファイルに対する時間的に連続する全ての参照は、同じ内部配列に格納されます。N.B. ファイル名の大文字・小文字に関しては、OSが気にしなくても関数にとても重要なことです。CSVRead(abc.txt, 0)とCSVRead(aBc.txt, 0)は異なる内部配列を参照します。

The *ALIAS feature allows the same file to be opened more than once, and also allows for shorter file names.
*ALIASは同じファイルが一度以上開かれることと、短いファイル名を使用することを許可します。

Each thread has its own internal pointer to its current row in the file array. When a thread first refers to the file it will be allocated the next free row in the array, so each thread will access a different row from all other threads. [Unless there are more threads than there are rows in the array.]
それぞれのスレッドはファイルの何行目を現在読み込んでいるのかを管理するポインタを内部に保持しています。スレッドが初めてファイルを参照する場合、配列の空いている行を確保します。そのため、スレッドは他のことなるスレッドとは違う行を取得することができます。[配列の行数より、スレッド数が多くない限り。]

Note: the function splits the line at every comma by default. If you want to enter columns containing commas, then you will need to change the delimiter to a character that does not appear in any column data, by setting the property: csvread.delimiter
注意:デフォルトの区切子はカンマです。カラムにカンマを含めたい場合には、csvread.delimiterプロパティを用いてカラム中に含まれない文字に区切子を変更する必要があります。

Parameters
Attribute Description Required
File Name The file (or *ALIAS) to read from Yes
ファイル名 読み込むファイル(もしくは *ALIAS) 必須

Column number The column number in the file. 0 = first column, 1 = second etc. "next" - go to next line of file. *ALIAS - open a file and assign it to the alias Yes
カラム番号 ファイル上のカラム番号。0は1番目のカラム、1は2番目のカラム、"next"はファイルの次の行へ対象を変更します。

For example, you could set up some variables as follows:
例として、以下のように変数を設定することができます。

        * COL1a ${__CSVRead(random.txt,0)}
        * COL2a ${__CSVRead(random.txt,1)}${__CSVRead(random.txt,next)}
        * COL1b ${__CSVRead(random.txt,0)}
        * COL2b ${__CSVRead(random.txt,1)}${__CSVRead(random.txt,next)}

This would read two columns from one line, and two columns from the next available line. If all the variables are defined on the same User Parameters Pre-Processor, then the lines will be consecutive. Otherwise, a different thread may grab the next line.
上記は一行から二つのカラムを読み込み、次の行からまた二つのカラムを読み込みます。Pre-Processor(前処理?)においてユーザ定義の同じパラメータの全てが設定されている場合には、行は連続しているとみなされます。それ以外の場合には、異なるスレッドは次の行に貪欲であるかもしれません。

The function is not suitable for use with large files, as the entire file is stored in memory. For larger files, use CSV Data Set Config element or StringFromFile .
ファイルの全てがメモリ上に格納されるので、関数は巨大なファイルには適していません。巨大なファイル向けには、CSVデータセット設定項目や、StringFormatFileが適しています。

19.5.9 __property
19.5.9 __property

The property function returns the value of a JMeter property. If the property value cannot be found, and no default has been supplied, it returns the property name. When supplying a default value, there is no need to provide a function name - the parameter can be set to null, and it will be ignored.
For example:
property関数はJMeterプロパティの値を得るために使用します。プロパティの値が見つからず、デフォルト値の設定も行なわれていない場合には、プロパティ名を返却します。デフォルト値が設定されている場合には、プロパティ名の返却はされません。また、デフォルト値にnullを設定した場合には無視されます。(訳注:だいぶ意訳しているがあってる?)

        * ${__property(user.dir)} - return value of user.dir
        * ${__property(user.dir)} - プロパティ user.dir の値。

        * ${__property(user.dir,UDIR)} - return value of user.dir and save in UDIR
        * ${__property(user.dir,UDIR)} - プロパティ user.dir の値を取得し、変数 UDIR に格納する。

        * ${__property(abcd,ABCD,atod)} - return value of property abcd (or "atod" if not defined) and save in ABCD
        * ${__property(abcd,ABCD,atod)} - プロパティ abcd の値(存在しないなら"atod")を取得し、変数ABCDへ格納。

        * ${__property(abcd,,atod)} - return value of property abcd (or "atod" if not defined) but don't save it
        * ${__property(abcd,,atod)} - プロパティ abcd(存在しないなら"atod")を取得し、変数への格納は行なわない。

Parameters
Attribute Description Required
Property Name The property name to be retrieved. Yes
プロパティ名 値を参照するプロパティ名 必須

Variable Name A reference name for reusing the value computed by this function. No
Variable Name この関数によって作られた値を再利用するための参照名 省略可

Default Value The default value for the property. No
Default Value プロパティに対するデフォルト値 省略可

19.5.10 __P
19.5.10 __P

This is a simplified property function which is intended for use with properties defined on the command line. Unlike the __property function, there is no option to save the value in a variable, and if no default value is supplied, it is assumed to be 1. The value of 1 was chosen because it is valid for common test variables such as loops, thread count, ramp up etc.
これは単純なプロパティ関数で、プロパティを将来的に使うためにJMeter起動時のコマンドラインで定義しておきます。__property関数とは異なり、変数の内部に値を格納するための手段は存在しません。デフォルト値が設定されていないなら1となります。1であるならばループ、スレッド数、ramp up等のテスト用変数として有効なためです。

For example:
例:

Define the property value:
プロパティ値の定義:

jmeter -Jgroup1.threads=7 -Jhostname1=www.realhost.edu
Fetch the values:
得られる値:

${__P(group1.threads)} - return the value of group1.threads
${__P(group1.threads)} - group1.threads の値を得る

${__P(group1.loops)} - return the value of group1.loops
${__P(group1.loops)} - group1.loops の値を得る

${__P(hostname,www.dummy.org)} - return value of property hostname or www.dummy.org if not defined
${__P(hostname,www.dummy.org)} - プロパティ hostname の値か、プロパティが未定義なら www.dummy.org

In the examples above, the first function call would return 7, the second would return 1 and the last would return www.dummy.org (unless those properties were defined elsewhere!)
上記例において、1番目の関数呼び出しは7を得ます。2番目は1です。最後は www.dummy.org です。

Parameters
Attribute Description Required
Property Name The property name to be retrieved. Yes
プロパティ名 値を取得するプロパティ。 必須

Default Value The default value for the property. If omitted, the default is set to "1". No
デフォルト値 プロパティに対するデフォルト値。省略時には1。 省略可

19.5.11 __log
19.5.11 __log

The log function logs a message, and returns its input string
log関数はメッセージを記録し、入力文字列を得ます。

Parameters
Attribute Description Required
String to be logged A string Yes
ログ出力文字列 文字列 必須

Log Level OUT, ERR, DEBUG, INFO (default), WARN or ERROR No
ログレベル OUT, ERR, DEBUG, INFO (デフォルト), WARN, ERRORのいずれか。 省略可

Throwable text If non-empty, creates a Throwable to pass to the logger No
Throwableテキスト 空ではない場合、loggerに出力させないキーワードを作成します。 省略可

Comment If present, it is displayed in the string. Useful for identifying what is being logged. No
コメント 存在する場合には、文字列中にコメントを表示します。何が原因でログ出力されたかを調べる場合に便利です。 省略可

The OUT and ERR log level names are used to direct the output to System.out and System.err respectively. In this case, the output is always printed - it does not depend on the current log setting.
ログレベルにOUTかERRが指定された場合には、Sytem.outとSystem.errの両方に直接出力されます。この場合には、常に出力されます。これは現在のログ設定に影響されません。

For example:
例:
          ${__log(Message)} - written to the log file as "...thread Name : Message"
          ${__log(Message)} - ログファイルに次のように出力されます。 "...thread Name : Message"

          ${__log(Message,OUT)} - written to console window
          ${__log(Message,OUT)} - コンソールウィンドウに出力されます。

          ${__log(${VAR},,,VAR=)} - written to log file as "...thread Name VAR=value"
          ${__log(${VAR},,
この議論は賞味期限が切れたので、アーカイブ化されています。 新たにコメントを付けることはできません。
typodupeerror

Stableって古いって意味だっけ? -- Debian初級

読み込み中...