You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Simon Brown <Si...@openwave.com> on 2007/09/26 15:46:10 UTC

iterating through 2 data sets

Hi,

 

I'm having problems with a while loop within a while loop, doing the
following (written in pseudocode):

 

String header, url;

header = readFromCSV(file1);

url = readFromCSV(file2);

 

while (header != "<EOF>")

{

            while (url != "<EOF>")

            {

                        HTTPRequest(header, url);

            }

}

 

Is there any way to do something equivalent in JMeter?  I currently
cannot get it to loop through all the urls and all the headers.  Am I
missing something?

 

Thanks,

 

Simon


RE: iterating through 2 data sets

Posted by Simon Brown <Si...@openwave.com>.
I should also have said - I don't know how many urls/user-agents will be
in the suite necessarily, as the suite is being constantly updated.  Is
there any way to loop through the files with an unknown number of
urls/user-agents?

Thanks

Simon

-----Original Message-----
From: sebb [mailto:sebbaz@gmail.com] 
Sent: 26 September 2007 15:50
To: JMeter Users List
Subject: Re: iterating through 2 data sets

Still does not work, because the url will remain set to <EOF> once
reached as there is nothing to change it.

As I said, JMeter cannot reset the file back to the beginning, so you
need to work round this - see my suggestions.

It might help to know what you are trying to test - perhaps there is a
better way of coding it.

On 26/09/2007, Simon Brown <Si...@openwave.com> wrote:
> Hi Sebb,
>
> Many thanks for your response.  Sorry - I made a mistake in the
> pseudocode - for every url in file 2 there should be a request made
for
> every header in file 1!
>
> It should be:
>
> String header, url;
> header = readFromCSV(file1);
> url = readFromCSV(file2);
>
> while (header != "<EOF>")
> {
>      while (url != "<EOF>")
>      {
>                HTTPRequest(header, url);
>                url = readFromCSV(file2);
>      }
>        header = readFromCSV(file1);
> }
>
> Regards,
>
> Simon
>
>
>
> -----Original Message-----
> From: sebb [mailto:sebbaz@gmail.com]
> Sent: 26 September 2007 14:54
> To: JMeter Users List
> Subject: Re: iterating through 2 data sets
>
> On 26/09/2007, Simon Brown <Si...@openwave.com> wrote:
> > Hi,
> >
> >
> >
> > I'm having problems with a while loop within a while loop, doing the
> > following (written in pseudocode):
> >
> >
> >
> > String header, url;
> >
> > header = readFromCSV(file1);
> >
> > url = readFromCSV(file2);
> >
> >
> >
> > while (header != "<EOF>")
> >
> > {
> >
> >            while (url != "<EOF>")
> >
> >            {
> >
> >                        HTTPRequest(header, url);
> >
> >            }
> >
> > }
> >
> >
> >
> > Is there any way to do something equivalent in JMeter?  I currently
> > cannot get it to loop through all the urls and all the headers.  Am
I
> > missing something?
>
> It looks as though the header and url are only read once.
>
> Also presumably the url loop needs to be reset for each header?
>
> It's not possible to "reset" a file reader in JMeter, though you can
> loop through a file repeatedly. If you know how many entries there are
> (or what the last one is) you can construct a loop around that.
>
> BTW, the Java Request sampler is good for testing - it does not need a
> server, and you can include any variable names you like in the label
> or response data etc.
>
> >
> > Thanks,
> >
> >
> >
> > Simon
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: iterating through 2 data sets

Posted by sebb <se...@gmail.com>.
On 26/09/2007, Simon Brown <Si...@openwave.com> wrote:
> Hi Sebb,
>
> So basically what you're saying is that the while loop in JMeter doesn't
> work like a conventional while loop in for e.g. Java?

No, I'm not.

The loop would not work in Java either - once you have reached
url=<EOF>, it stays there.

What is different about JMeter is that it is difficult/impossible to
reset the file reader.

> I'm doing a regression test on a suite of urls with different
> user-agents.  I want to send a request to each url for all the
> user-agents.  Both the url and user-agent lists are stored in csv files.
>
> Any suggestions?

Yes, see my earlier posting as to how you can get round the JMeter
file reset limitation.

> Thanks,
>
> Simon
>
> -----Original Message-----
> From: sebb [mailto:sebbaz@gmail.com]
> Sent: 26 September 2007 15:50
> To: JMeter Users List
> Subject: Re: iterating through 2 data sets
>
> Still does not work, because the url will remain set to <EOF> once
> reached as there is nothing to change it.
>
> As I said, JMeter cannot reset the file back to the beginning, so you
> need to work round this - see my suggestions.
>
> It might help to know what you are trying to test - perhaps there is a
> better way of coding it.
>
> On 26/09/2007, Simon Brown <Si...@openwave.com> wrote:
> > Hi Sebb,
> >
> > Many thanks for your response.  Sorry - I made a mistake in the
> > pseudocode - for every url in file 2 there should be a request made
> for
> > every header in file 1!
> >
> > It should be:
> >
> > String header, url;
> > header = readFromCSV(file1);
> > url = readFromCSV(file2);
> >
> > while (header != "<EOF>")
> > {
> >      while (url != "<EOF>")
> >      {
> >                HTTPRequest(header, url);
> >                url = readFromCSV(file2);
> >      }
> >        header = readFromCSV(file1);
> > }
> >
> > Regards,
> >
> > Simon
> >
> >
> >
> > -----Original Message-----
> > From: sebb [mailto:sebbaz@gmail.com]
> > Sent: 26 September 2007 14:54
> > To: JMeter Users List
> > Subject: Re: iterating through 2 data sets
> >
> > On 26/09/2007, Simon Brown <Si...@openwave.com> wrote:
> > > Hi,
> > >
> > >
> > >
> > > I'm having problems with a while loop within a while loop, doing the
> > > following (written in pseudocode):
> > >
> > >
> > >
> > > String header, url;
> > >
> > > header = readFromCSV(file1);
> > >
> > > url = readFromCSV(file2);
> > >
> > >
> > >
> > > while (header != "<EOF>")
> > >
> > > {
> > >
> > >            while (url != "<EOF>")
> > >
> > >            {
> > >
> > >                        HTTPRequest(header, url);
> > >
> > >            }
> > >
> > > }
> > >
> > >
> > >
> > > Is there any way to do something equivalent in JMeter?  I currently
> > > cannot get it to loop through all the urls and all the headers.  Am
> I
> > > missing something?
> >
> > It looks as though the header and url are only read once.
> >
> > Also presumably the url loop needs to be reset for each header?
> >
> > It's not possible to "reset" a file reader in JMeter, though you can
> > loop through a file repeatedly. If you know how many entries there are
> > (or what the last one is) you can construct a loop around that.
> >
> > BTW, the Java Request sampler is good for testing - it does not need a
> > server, and you can include any variable names you like in the label
> > or response data etc.
> >
> > >
> > > Thanks,
> > >
> > >
> > >
> > > Simon
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


RE: iterating through 2 data sets

Posted by Simon Brown <Si...@openwave.com>.
Hi Sebb,

So basically what you're saying is that the while loop in JMeter doesn't
work like a conventional while loop in for e.g. Java?

I'm doing a regression test on a suite of urls with different
user-agents.  I want to send a request to each url for all the
user-agents.  Both the url and user-agent lists are stored in csv files.

Any suggestions?

Thanks,

Simon

-----Original Message-----
From: sebb [mailto:sebbaz@gmail.com] 
Sent: 26 September 2007 15:50
To: JMeter Users List
Subject: Re: iterating through 2 data sets

Still does not work, because the url will remain set to <EOF> once
reached as there is nothing to change it.

As I said, JMeter cannot reset the file back to the beginning, so you
need to work round this - see my suggestions.

It might help to know what you are trying to test - perhaps there is a
better way of coding it.

On 26/09/2007, Simon Brown <Si...@openwave.com> wrote:
> Hi Sebb,
>
> Many thanks for your response.  Sorry - I made a mistake in the
> pseudocode - for every url in file 2 there should be a request made
for
> every header in file 1!
>
> It should be:
>
> String header, url;
> header = readFromCSV(file1);
> url = readFromCSV(file2);
>
> while (header != "<EOF>")
> {
>      while (url != "<EOF>")
>      {
>                HTTPRequest(header, url);
>                url = readFromCSV(file2);
>      }
>        header = readFromCSV(file1);
> }
>
> Regards,
>
> Simon
>
>
>
> -----Original Message-----
> From: sebb [mailto:sebbaz@gmail.com]
> Sent: 26 September 2007 14:54
> To: JMeter Users List
> Subject: Re: iterating through 2 data sets
>
> On 26/09/2007, Simon Brown <Si...@openwave.com> wrote:
> > Hi,
> >
> >
> >
> > I'm having problems with a while loop within a while loop, doing the
> > following (written in pseudocode):
> >
> >
> >
> > String header, url;
> >
> > header = readFromCSV(file1);
> >
> > url = readFromCSV(file2);
> >
> >
> >
> > while (header != "<EOF>")
> >
> > {
> >
> >            while (url != "<EOF>")
> >
> >            {
> >
> >                        HTTPRequest(header, url);
> >
> >            }
> >
> > }
> >
> >
> >
> > Is there any way to do something equivalent in JMeter?  I currently
> > cannot get it to loop through all the urls and all the headers.  Am
I
> > missing something?
>
> It looks as though the header and url are only read once.
>
> Also presumably the url loop needs to be reset for each header?
>
> It's not possible to "reset" a file reader in JMeter, though you can
> loop through a file repeatedly. If you know how many entries there are
> (or what the last one is) you can construct a loop around that.
>
> BTW, the Java Request sampler is good for testing - it does not need a
> server, and you can include any variable names you like in the label
> or response data etc.
>
> >
> > Thanks,
> >
> >
> >
> > Simon
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: iterating through 2 data sets

Posted by sebb <se...@gmail.com>.
Still does not work, because the url will remain set to <EOF> once
reached as there is nothing to change it.

As I said, JMeter cannot reset the file back to the beginning, so you
need to work round this - see my suggestions.

It might help to know what you are trying to test - perhaps there is a
better way of coding it.

On 26/09/2007, Simon Brown <Si...@openwave.com> wrote:
> Hi Sebb,
>
> Many thanks for your response.  Sorry - I made a mistake in the
> pseudocode - for every url in file 2 there should be a request made for
> every header in file 1!
>
> It should be:
>
> String header, url;
> header = readFromCSV(file1);
> url = readFromCSV(file2);
>
> while (header != "<EOF>")
> {
>      while (url != "<EOF>")
>      {
>                HTTPRequest(header, url);
>                url = readFromCSV(file2);
>      }
>        header = readFromCSV(file1);
> }
>
> Regards,
>
> Simon
>
>
>
> -----Original Message-----
> From: sebb [mailto:sebbaz@gmail.com]
> Sent: 26 September 2007 14:54
> To: JMeter Users List
> Subject: Re: iterating through 2 data sets
>
> On 26/09/2007, Simon Brown <Si...@openwave.com> wrote:
> > Hi,
> >
> >
> >
> > I'm having problems with a while loop within a while loop, doing the
> > following (written in pseudocode):
> >
> >
> >
> > String header, url;
> >
> > header = readFromCSV(file1);
> >
> > url = readFromCSV(file2);
> >
> >
> >
> > while (header != "<EOF>")
> >
> > {
> >
> >            while (url != "<EOF>")
> >
> >            {
> >
> >                        HTTPRequest(header, url);
> >
> >            }
> >
> > }
> >
> >
> >
> > Is there any way to do something equivalent in JMeter?  I currently
> > cannot get it to loop through all the urls and all the headers.  Am I
> > missing something?
>
> It looks as though the header and url are only read once.
>
> Also presumably the url loop needs to be reset for each header?
>
> It's not possible to "reset" a file reader in JMeter, though you can
> loop through a file repeatedly. If you know how many entries there are
> (or what the last one is) you can construct a loop around that.
>
> BTW, the Java Request sampler is good for testing - it does not need a
> server, and you can include any variable names you like in the label
> or response data etc.
>
> >
> > Thanks,
> >
> >
> >
> > Simon
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


RE: iterating through 2 data sets

Posted by Simon Brown <Si...@openwave.com>.
Hi Sebb,

Many thanks for your response.  Sorry - I made a mistake in the
pseudocode - for every url in file 2 there should be a request made for
every header in file 1!

It should be:

String header, url;
header = readFromCSV(file1);
url = readFromCSV(file2);

while (header != "<EOF>")
{
      while (url != "<EOF>")
      {
		HTTPRequest(header, url);
		url = readFromCSV(file2);
      }
	header = readFromCSV(file1);
}

Regards,

Simon



-----Original Message-----
From: sebb [mailto:sebbaz@gmail.com] 
Sent: 26 September 2007 14:54
To: JMeter Users List
Subject: Re: iterating through 2 data sets

On 26/09/2007, Simon Brown <Si...@openwave.com> wrote:
> Hi,
>
>
>
> I'm having problems with a while loop within a while loop, doing the
> following (written in pseudocode):
>
>
>
> String header, url;
>
> header = readFromCSV(file1);
>
> url = readFromCSV(file2);
>
>
>
> while (header != "<EOF>")
>
> {
>
>            while (url != "<EOF>")
>
>            {
>
>                        HTTPRequest(header, url);
>
>            }
>
> }
>
>
>
> Is there any way to do something equivalent in JMeter?  I currently
> cannot get it to loop through all the urls and all the headers.  Am I
> missing something?

It looks as though the header and url are only read once.

Also presumably the url loop needs to be reset for each header?

It's not possible to "reset" a file reader in JMeter, though you can
loop through a file repeatedly. If you know how many entries there are
(or what the last one is) you can construct a loop around that.

BTW, the Java Request sampler is good for testing - it does not need a
server, and you can include any variable names you like in the label
or response data etc.

>
> Thanks,
>
>
>
> Simon
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: iterating through 2 data sets

Posted by sebb <se...@gmail.com>.
On 26/09/2007, Simon Brown <Si...@openwave.com> wrote:
> Hi,
>
>
>
> I'm having problems with a while loop within a while loop, doing the
> following (written in pseudocode):
>
>
>
> String header, url;
>
> header = readFromCSV(file1);
>
> url = readFromCSV(file2);
>
>
>
> while (header != "<EOF>")
>
> {
>
>            while (url != "<EOF>")
>
>            {
>
>                        HTTPRequest(header, url);
>
>            }
>
> }
>
>
>
> Is there any way to do something equivalent in JMeter?  I currently
> cannot get it to loop through all the urls and all the headers.  Am I
> missing something?

It looks as though the header and url are only read once.

Also presumably the url loop needs to be reset for each header?

It's not possible to "reset" a file reader in JMeter, though you can
loop through a file repeatedly. If you know how many entries there are
(or what the last one is) you can construct a loop around that.

BTW, the Java Request sampler is good for testing - it does not need a
server, and you can include any variable names you like in the label
or response data etc.

>
> Thanks,
>
>
>
> Simon
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org