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]

Reply via email to