Dear Liao:
You wrote:
>>>>> for the following, I did not get any result from the View Result in the
>>>>> table, listener
Perhaps an example would be useful. Run the attached test plan ("Java Request
shows variable value.jmx") and look at the View Results In Table control panel.
The first HTTP request returns the Google search page and uses a Regular
Expression Extractor to create a variable called Result. After that, you can
see Java Request elements that display predefined variables created for a
multiple-match search.
I find the JMeter user manual's explanation of the Regular Expression Extractor
element very hard to understand. From my own testing, I believe that the
Regular Expression Extractor can create two different sets of predefined
variables, depending on whether the Match No. parameter is positive or negative.
For a positive value (0, 1, 2 ...) in the Match No. parameter, the Regular
Expression Extractor element does this:
1. Finds the first match in the response text.
2. Creates the ${refName} variable with the name specified by the Reference
Name parameter.
3. Gives the ${refName} variable a string defined by the Template parameter.
The result could be the whole match ($0$), or the first group in the match
($1$), or the second group in the match ($2$), and so on.
4. Creates predefined variables for the match and its groups, if any. They
follow the naming pattern ${refName_gn}, where n = 0 returns the whole match, n
= 1 returns the first group in the match, n = 2 returns the second group in the
match, and so on. These predefined variables are not affected by the Template
parameter.
For a negative value (-1) in the Match No. parameter, the Regular Expression
Extractor element does this:
1. Finds all matches in the response text.
2. Creates the ${refName} variable with the name specified by the Reference
Name parameter.
3. Gives the ${refName} variable the value of the Default Value parameter. It
is not affected by the Template parameter.
4. Creates predefined variables for the match and its groups, if any. They
follow the naming pattern refName_n_gm, where n specifies a particular match; m
= 0 returns the whole match, m = 1 returns the first group in the match, m = 2
returns the second group in the match, and so on. These predefined variables
are not affected by the Template parameter.
A multiple-match search also creates a set of variables that follow the naming
pattern refName_n. These predefined variables ARE affected by the Template
variable. I do not use them. For testing, I prefer to use an exact match or
exact group, such as those described in the two item 4s above. I do not need to
add arbitrary strings to strings derived from matches or groups or construct
strings from multiple matches and groups. That allows me to ignore the Template
parameter.
I hope this helps.
Sincerely yours,
Kyle
-----Original Message-----
From: Liao, Avian [mailto:[EMAIL PROTECTED]
Sent: Thursday, December 02, 2004 1:16 PM
To: Kyle McAbee
Cc: JMeter Users List
Subject: RE: nesting constants/variables between two groups in template
To display a variable value while a test plan is running, follow these steps.
1. Add a Java Request element (a Sampler) to the test plan after the point
in the test plan where the variable is defined by an element or a function.
2. In the Java Request, do the following:
a. Set the Label parameter to display the variable name and variable
value. For example:
MyVariable: ${MyVariable}
b. Set the Status parameter to "OK" or "FAIL".
"OK" allows the test plan execution to continue.
"FAIL" forces test plan execution to stop.
>>>>> for the following, I did not get any result from the View Result in the
>>>>> table, listener
3 Add a View Results in Table element (a Listener) to the test plan.
4. Run the test plan.
The View Results in Table element displays the Java Request response
with the variable name and variable value.
>>>>.>>.>
AL
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]