Ok,
Below is an example. I can't figure out how to extract values in a loop if
the regular expression had more than one group?
Thanks in advance
-Justin
<jmeterTestPlan version="1.1" properties="1.7">
<hashTree>
<TestPlan>
<elementProp name="TestPlan.user_defined_variables"
elementType="org.apache.jmeter.config.Arguments">
<stringProp
name="TestElement.gui_class">org.apache.jmeter.config.gui.ArgumentsPanel</st
ringProp>
<stringProp
name="TestElement.test_class">org.apache.jmeter.config.Arguments</stringProp
>
<collectionProp name="Arguments.arguments"/>
<stringProp name="TestElement.name">User Defined
Variables</stringProp>
<boolProp name="TestElement.enabled">true</boolProp>
</elementProp>
<stringProp
name="TestElement.gui_class">org.apache.jmeter.control.gui.TestPlanGui</stri
ngProp>
<boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
<stringProp
name="TestElement.test_class">org.apache.jmeter.testelement.TestPlan</string
Prop>
<stringProp name="TestElement.name">Test Plan</stringProp>
<boolProp name="TestPlan.functional_mode">false</boolProp>
<boolProp name="TestElement.enabled">true</boolProp>
<stringProp name="TestPlan.comments"></stringProp>
</TestPlan>
<hashTree>
<ThreadGroup>
<longProp name="ThreadGroup.start_time">1124303616000</longProp>
<stringProp
name="TestElement.test_class">org.apache.jmeter.threads.ThreadGroup</stringP
rop>
<stringProp name="ThreadGroup.delay"></stringProp>
<stringProp name="ThreadGroup.duration"></stringProp>
<boolProp name="TestElement.enabled">true</boolProp>
<stringProp name="ThreadGroup.num_threads">1</stringProp>
<boolProp name="ThreadGroup.scheduler">false</boolProp>
<stringProp
name="TestElement.gui_class">org.apache.jmeter.threads.gui.ThreadGroupGui</s
tringProp>
<elementProp name="ThreadGroup.main_controller"
elementType="org.apache.jmeter.control.LoopController">
<stringProp
name="TestElement.gui_class">org.apache.jmeter.control.gui.LoopControlPanel<
/stringProp>
<stringProp name="LoopController.loops">1</stringProp>
<stringProp
name="TestElement.test_class">org.apache.jmeter.control.LoopController</stri
ngProp>
<stringProp name="TestElement.name">Loop Controller</stringProp>
<boolProp name="TestElement.enabled">true</boolProp>
<boolProp name="LoopController.continue_forever">false</boolProp>
</elementProp>
<stringProp name="TestElement.name">use cases</stringProp>
<longProp name="ThreadGroup.end_time">1124303616000</longProp>
<stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
<stringProp name="ThreadGroup.ramp_time">1</stringProp>
</ThreadGroup>
<hashTree>
<ResultCollector>
<stringProp
name="TestElement.gui_class">org.apache.jmeter.visualizers.ViewResultsFullVi
sualizer</stringProp>
<stringProp
name="TestElement.test_class">org.apache.jmeter.reporters.ResultCollector</s
tringProp>
<stringProp name="TestElement.name">View Results Tree</stringProp>
<objProp>
<value
class="org.apache.jmeter.samplers.SampleSaveConfiguration">
<time>true</time>
<latency>true</latency>
<timestamp>true</timestamp>
<success>true</success>
<label>true</label>
<code>true</code>
<message>true</message>
<threadName>true</threadName>
<dataType>true</dataType>
<encoding>false</encoding>
<assertions>true</assertions>
<subresults>true</subresults>
<responseData>false</responseData>
<samplerData>false</samplerData>
<xml>true</xml>
<fieldNames>false</fieldNames>
<responseHeaders>false</responseHeaders>
<requestHeaders>false</requestHeaders>
<responseDataOnError>false</responseDataOnError>
<saveAssertionResultsFailureMessage>false</saveAssertionResultsFailureMessag
e>
<assertionsResultsToSave>0</assertionsResultsToSave>
<delimiter>,</delimiter>
<printMilliseconds>true</printMilliseconds>
</value>
<name>saveConfig</name>
</objProp>
<boolProp name="TestElement.enabled">true</boolProp>
<stringProp name="filename"></stringProp>
<boolProp name="ResultCollector.error_logging">false</boolProp>
</ResultCollector>
<hashTree/>
<RecordingController>
<stringProp
name="TestElement.gui_class">org.apache.jmeter.protocol.http.control.gui.Rec
ordController</stringProp>
<stringProp
name="TestElement.test_class">org.apache.jmeter.protocol.http.control.Record
ingController</stringProp>
<stringProp name="TestElement.name">Recording
Controller</stringProp>
<boolProp name="TestElement.enabled">true</boolProp>
</RecordingController>
<hashTree>
<HTTPSampler>
<stringProp name="HTTPSampler.path"></stringProp>
<stringProp
name="TestElement.test_class">org.apache.jmeter.protocol.http.sampler.HTTPSa
mpler</stringProp>
<stringProp name="HTTPSampler.method">GET</stringProp>
<boolProp name="HTTPSampler.use_keepalive">true</boolProp>
<stringProp name="HTTPSampler.protocol">http</stringProp>
<boolProp name="TestElement.enabled">true</boolProp>
<boolProp name="HTTPSampler.follow_redirects">false</boolProp>
<stringProp name="HTTPSampler.port"></stringProp>
<elementProp name="HTTPsampler.Arguments"
elementType="org.apache.jmeter.config.Arguments">
<stringProp
name="TestElement.gui_class">org.apache.jmeter.protocol.http.gui.HTTPArgumen
tsPanel</stringProp>
<stringProp
name="TestElement.test_class">org.apache.jmeter.config.Arguments</stringProp
>
<collectionProp name="Arguments.arguments"/>
<stringProp name="TestElement.name"></stringProp>
<boolProp name="TestElement.enabled">true</boolProp>
</elementProp>
<stringProp name="HTTPSampler.mimetype"></stringProp>
<stringProp
name="TestElement.gui_class">org.apache.jmeter.protocol.http.control.gui.Htt
pTestSampleGui</stringProp>
<stringProp name="HTTPSampler.FILE_FIELD"></stringProp>
<stringProp
name="TestElement.name">http://www.google.com/</stringProp>
<stringProp name="HTTPSampler.monitor">false</stringProp>
<stringProp
name="HTTPSampler.domain">www.google.com</stringProp>
<stringProp name="HTTPSampler.FILE_NAME"></stringProp>
<boolProp name="HTTPSampler.auto_redirects">false</boolProp>
</HTTPSampler>
<hashTree>
<RegexExtractor>
<stringProp name="RegexExtractor.default">fout</stringProp>
<stringProp
name="TestElement.gui_class">org.apache.jmeter.extractor.gui.RegexExtractorG
ui</stringProp>
<stringProp
name="TestElement.test_class">org.apache.jmeter.extractor.RegexExtractor</st
ringProp>
<stringProp
name="RegexExtractor.regex">href="(http)://([^/]+)([^"]+)"</s
tringProp>
<stringProp name="TestElement.name">Regular Expression
Extractor</stringProp>
<boolProp name="TestElement.enabled">true</boolProp>
<stringProp
name="RegexExtractor.useHeaders">false</stringProp>
<stringProp name="RegexExtractor.template">$0$</stringProp>
<stringProp name="RegexExtractor.match_number">-1</stringProp>
<stringProp
name="RegexExtractor.refname">googleRef</stringProp>
</RegexExtractor>
<hashTree/>
</hashTree>
<org.apache.jmeter.control.ForeachController>
<stringProp
name="ForeachController.inputVal">googleRef</stringProp>
<stringProp
name="TestElement.gui_class">org.apache.jmeter.control.gui.ForeachControlPan
el</stringProp>
<stringProp
name="ForeachController.returnVal">googleRefOut</stringProp>
<stringProp
name="TestElement.test_class">org.apache.jmeter.control.ForeachController</s
tringProp>
<stringProp name="TestElement.name">ForEach google</stringProp>
<boolProp name="TestElement.enabled">true</boolProp>
<boolProp name="ForeachController.useSeparator">true</boolProp>
</org.apache.jmeter.control.ForeachController>
<hashTree>
<HTTPSampler>
<stringProp name="HTTPSampler.path"></stringProp>
<stringProp
name="TestElement.test_class">org.apache.jmeter.protocol.http.sampler.HTTPSa
mpler</stringProp>
<stringProp name="HTTPSampler.method">GET</stringProp>
<boolProp name="HTTPSampler.use_keepalive">true</boolProp>
<stringProp name="HTTPSampler.protocol">http</stringProp>
<boolProp name="TestElement.enabled">true</boolProp>
<boolProp name="HTTPSampler.follow_redirects">false</boolProp>
<stringProp name="HTTPSampler.port"></stringProp>
<elementProp name="HTTPsampler.Arguments"
elementType="org.apache.jmeter.config.Arguments">
<stringProp
name="TestElement.gui_class">org.apache.jmeter.protocol.http.gui.HTTPArgumen
tsPanel</stringProp>
<stringProp
name="TestElement.test_class">org.apache.jmeter.config.Arguments</stringProp
>
<collectionProp name="Arguments.arguments">
<elementProp name=""
elementType="org.apache.jmeter.protocol.http.util.HTTPArgument">
<stringProp name="Argument.metadata">=</stringProp>
<stringProp
name="Argument.value">${googleRefOut_g1}</stringProp>
<boolProp name="HTTPArgument.use_equals">true</boolProp>
<stringProp name="Argument.name">testA</stringProp>
<boolProp
name="HTTPArgument.always_encode">false</boolProp>
</elementProp>
<elementProp name=""
elementType="org.apache.jmeter.protocol.http.util.HTTPArgument">
<stringProp name="Argument.metadata">=</stringProp>
<stringProp
name="Argument.value">${googleRefOut_g2}</stringProp>
<boolProp name="HTTPArgument.use_equals">true</boolProp>
<stringProp name="Argument.name">testb</stringProp>
<boolProp
name="HTTPArgument.always_encode">false</boolProp>
</elementProp>
<elementProp name=""
elementType="org.apache.jmeter.protocol.http.util.HTTPArgument">
<stringProp name="Argument.metadata">=</stringProp>
<stringProp
name="Argument.value">${googleRefOut_g3}</stringProp>
<boolProp name="HTTPArgument.use_equals">true</boolProp>
<stringProp name="Argument.name">testc</stringProp>
<boolProp
name="HTTPArgument.always_encode">false</boolProp>
</elementProp>
<elementProp name=""
elementType="org.apache.jmeter.protocol.http.util.HTTPArgument">
<stringProp name="Argument.metadata">=</stringProp>
<stringProp
name="Argument.value">${googleRefOut_g}</stringProp>
<boolProp name="HTTPArgument.use_equals">true</boolProp>
<stringProp name="Argument.name">testd</stringProp>
<boolProp
name="HTTPArgument.always_encode">false</boolProp>
</elementProp>
<elementProp name=""
elementType="org.apache.jmeter.protocol.http.util.HTTPArgument">
<stringProp name="Argument.metadata">=</stringProp>
<stringProp
name="Argument.value">${googleRefOut_1_g1}</stringProp>
<boolProp name="HTTPArgument.use_equals">true</boolProp>
<stringProp name="Argument.name">testf</stringProp>
<boolProp
name="HTTPArgument.always_encode">false</boolProp>
</elementProp>
<elementProp name=""
elementType="org.apache.jmeter.protocol.http.util.HTTPArgument">
<stringProp name="Argument.metadata">=</stringProp>
<stringProp
name="Argument.value">${googleRefOut1}</stringProp>
<boolProp name="HTTPArgument.use_equals">true</boolProp>
<stringProp name="Argument.name">testg</stringProp>
<boolProp
name="HTTPArgument.always_encode">false</boolProp>
</elementProp>
<elementProp name=""
elementType="org.apache.jmeter.protocol.http.util.HTTPArgument">
<stringProp name="Argument.metadata">=</stringProp>
<stringProp
name="Argument.value">${googleRefOut_g1_1}</stringProp>
<boolProp name="HTTPArgument.use_equals">true</boolProp>
<stringProp name="Argument.name">testh</stringProp>
<boolProp
name="HTTPArgument.always_encode">false</boolProp>
</elementProp>
<elementProp name=""
elementType="org.apache.jmeter.protocol.http.util.HTTPArgument">
<stringProp name="Argument.metadata">=</stringProp>
<stringProp
name="Argument.value">${googleRefOut_1_g}</stringProp>
<boolProp name="HTTPArgument.use_equals">true</boolProp>
<stringProp name="Argument.name">testi</stringProp>
<boolProp
name="HTTPArgument.always_encode">false</boolProp>
</elementProp>
</collectionProp>
<stringProp name="TestElement.name"></stringProp>
<boolProp name="TestElement.enabled">true</boolProp>
</elementProp>
<stringProp name="HTTPSampler.mimetype"></stringProp>
<stringProp
name="TestElement.gui_class">org.apache.jmeter.protocol.http.control.gui.Htt
pTestSampleGui</stringProp>
<stringProp name="HTTPSampler.FILE_FIELD"></stringProp>
<stringProp name="TestElement.name">google href</stringProp>
<stringProp name="HTTPSampler.monitor">false</stringProp>
<stringProp
name="HTTPSampler.domain">www.yahoo.com</stringProp>
<stringProp name="HTTPSampler.FILE_NAME"></stringProp>
<boolProp name="HTTPSampler.auto_redirects">false</boolProp>
</HTTPSampler>
<hashTree/>
</hashTree>
</hashTree>
</hashTree>
</hashTree>
</hashTree>
</jmeterTestPlan>
-----Original Message-----
From: Friedl, Justin
Sent: Thursday, September 08, 2005 7:53 AM
To: 'JMeter Users List'
Subject: RE: Foreach loops with groups
I am still stuck on this. Has anyone successfully done this (foreach loop
with three groups)? It seems like a basic use case to me? I'm sure I'm
just missing something little. I'll try and post a simple example later...
Thanks in advance,
Justin
-----Original Message-----
From: Friedl, Justin
Sent: Tuesday, September 06, 2005 3:50 PM
To: 'JMeter Users List'
Subject: RE: Foreach loops with groups
sendRequest appears once for every row in an html table. I want to exercise
(an HTTP sample) for every link in the table. Therefore I want to extract
three values for each call to sendRequest and pass those into an HTTP
request.
Docs:
"By omitting the "_" separator, the ForEach Controller can be used to loop
through the groups by using the input variable refName_g, and can also loop
through all the groups in all the matches by using an input variable of the
form refName_${C}_g, where C is a counter variable."
This is confusing to me? To access group 1 of a variable in a for each loop
what do I do? ${synopticDataOut_${C}_g1}? A variable inside a variable
doesn't seem to work. What is C? Is that the name of a counter that I
added as a child of the for each loop? That doesn't seem to work either.
Or maybe it's an implicit counter? Also, by omitting the "_" separator the
for each loop is never entered, (see below).
I appreciate your help,
Justin
-----Original Message-----
From: sebb [mailto:[EMAIL PROTECTED]
Sent: Tuesday, September 06, 2005 3:34 PM
To: JMeter Users List
Subject: Re: Foreach loops with groups
On 06/09/05, Friedl, Justin <[EMAIL PROTECTED]> wrote:
> Here's what I have:
>
> Regular Expression Extractor
>
> reference name: synopticDataIn
> Regex: .*sendRequest\((\d+),(\d+), '(\d+-\d+).*
You probably don't need .* before and after.
> template: $1$
> Match No.: -1
Do you really want all matches?
How many times does sendRequest appear?
> Default Value: fout
>
> ForEach controller
> Input variable prefix: synopticDataIn
> Output variable name: synopticDataOut
> Add "_" before number: checked
>
> then looking at the request tab in the view Results Tree the
> parameters
> become:
> ${synopticDataIn_1_g1} becomes 11479239 ${synopticDataIn_1_g2} becomes
> 1529
OK.
> ${synopticDataOut_g1} becomes ${synopticDataOut_g1}
ForEach only sets _one_ variable, i.e. ${synopticDataOut}
> ${synopticDataOut} becomes 11479239
ForEach sets ${synopticDataOut} to ${synopticDataIn_1}, ${synopticDataIn_2},
etc. These are the values of $1$ for each match. Is this what you wanted?
>From the doc:
"By omitting the "_" separator, the ForEach Controller can be used to loop
through the groups by using the input variable refName_g, and can also loop
through all the groups in all the matches by using an input variable of the
form refName_${C}_g, where C is a counter variable."
These are wrong - ForEach only sets ${synopticDataOut}
> ${synopticDataOut_1_g1} becomes ${synopticDataOut_1_g1}
> ${synopticDataOut_g1} becomes ${synopticDataOut_g1}
>
> if I switch the template to $0$
> ${synopticDataOut} becomes <a id="a_1" href="#"
> onClick="processLoading(parent.parent.searchResults);
> sendRequest(11479239,1529, '21-00');
> parent.parent.swapFrame('searchResults');">
> ${synopticDataIn_1_g1} becomes 11479239 ${synopticDataIn_1_g2} becomes
> 1529
>
> I cannot figure out the proper syntax. I thought
> ${synopticDataOut_g1} should work. Any ideas? Examples?
No, it won't work.
See above and the documentation for RegexExtractor and ForEach.
>
> Thanks in advance,
> Justin
>
>
>
> -----Original Message-----
> From: sebb [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, August 31, 2005 4:09 PM
> To: JMeter Users List
> Subject: Re: Foreach loops with groups
>
>
> Yes, the foreach loop won't start if the first variable is missing.
>
> What do your Regex and ForEach test elements look like now?
>
> S.
> On 31/08/05, Friedl, Justin <[EMAIL PROTECTED]> wrote:
> > Thanks. I tried this. Now it won't even go into the foreach loop.
> > My guess is it's because the foreach input var doesn't match the
> > regex reference name.
> >
> >
> >
> >
> >
> > -----Original Message-----
> > From: sebb [mailto:[EMAIL PROTECTED]
> > Sent: Wednesday, August 31, 2005 10:21 AM
> > To: JMeter Users List
> > Subject: Re: Foreach loops with groups
> >
> >
> > Try
> >
> > ForEach:
> > Input: RegexVar_g
> > Output: outputVar
> > Add '-': unchecked
> >
> > and refer to
> >
> > ${outputVar}
> >
> > S.
> > On 31/08/05, Friedl, Justin <[EMAIL PROTECTED]> wrote:
> > > I have a regular expression that returns three groups:
> > > .*sendRequest\((\d+),(\d+), '(\d+-\d+).* I then have a foreach
> > > controller in which I map input var "inputVar" to output var
> > > "outputVar" with the "add '_' before number" checked.
> > >
> > > How can I access variables in a sample controller within the
> > > foreach loop? I've tried:
> > > ${outputVar_g1},${outputVar_1},${outputVar1},${outputVarg1},${outp
> > > ut
> > > Va
> > > r_g1_1
> > > },${outputVar_1_g1}
> > > Nothing seems to work. The result view tree shows the sample is
being
> > > called but the params output the literals and don't seem to
> > > replace the variables with values.
> > >
> > > I'm using jmeter 2.1 and I see in the changes that "ForEach
> > > Controller can now loop through sets of groups" was fixed in 2.0.3
> > >
> > > I'm sure I'm missing something simple.
> > >
> > > Thanks in advance,
> > > Justin
> > >
> > >
> > >
> >
> > --------------------------------------------------------------------
> > -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]