You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Léon Keijser <ke...@stone-it.com> on 2014/04/10 09:43:18 UTC

variable within csv

Hi,

I have a CSV that contains parts of an URI:

/new.html
/part.html
/some.html

In my test I loop over the CSV using variable $SUBPAGE. Now, one part
can contain parameters:

/new.html?period=1
/new.html?period=2
etc.

I thought of making the number a random variable (1,2,3,4,5) and
including the variable name in the CSV:

/new.html?period=${RANDNUM}

which would then translate to '?period=1' , '?period=2', etc.

Unfortunately that doesn't work, as jmeter won't fill in the variable. I
could remove the '/new.html' from my original CSV and make a separate
request for that, using the RANDNUM variable, but perhaps there's a
better way. Any advice is welcome!

regards,

Léon



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


Re: variable within csv

Posted by ZK <st...@gmail.com>.
Hi,
I would remove the ${RANDNUM} from the CSV
and in the PAth for the HTTP Sampler:

${SUBPAGE}?period=${__Random(1,5,)}

The Example above for the Random Function has '1' as the minimum value and
'5' as the maximum value for the random number

The Function is detailed here:
http://jmeter.apache.org/usermanual/functions.html#__Random
<http://jmeter.apache.org/usermanual/functions.html#__Random>  



--
View this message in context: http://jmeter.512774.n5.nabble.com/variable-within-csv-tp5719780p5719782.html
Sent from the JMeter - User mailing list archive at Nabble.com.

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


Re: variable within csv

Posted by Léon Keijser <ke...@stone-it.com>.
Hi,


On Thu, 2014-04-10 at 09:11 +0000, Ryabtsev Vladimir wrote:
> 1. Do you really need CSV file for your case? I think you can use Interleave Controller or Random Controller for this, or prepare path in special variable in JSR223 Sampler and then use it.
> 2. You can add random period directly in Path field of HTTP Request, for example /new.html?period=${__Random(1,5)}

The CSV contains over 100 pages that jmeter should access. If I make the
test as you (and ZK, post before here) suggest I will have to create
that many samplers. And it's only one page that accepts the parameters.
All other pages are requested without any. 

I modified the CSV now and just included
the /new.html?param=1 , /new.html?param=2 lines, which are only 5 of
them. Was the fastest way to 'fix' this since I have to run the test
this afternoon :)

Thanks,

Léon


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


RE: variable within csv

Posted by Ryabtsev Vladimir <v....@pflb.ru>.
Hi, Léon.

1. Do you really need CSV file for your case? I think you can use Interleave Controller or Random Controller for this, or prepare path in special variable in JSR223 Sampler and then use it.
2. You can add random period directly in Path field of HTTP Request, for example /new.html?period=${__Random(1,5)}

-----
VR

-----Original Message-----
From: Léon Keijser [mailto:keijser@stone-it.com] 
Sent: Thursday, April 10, 2014 11:43 AM
To: user@jmeter.apache.org
Subject: variable within csv

Hi,

I have a CSV that contains parts of an URI:

/new.html
/part.html
/some.html

In my test I loop over the CSV using variable $SUBPAGE. Now, one part can contain parameters:

/new.html?period=1
/new.html?period=2
etc.

I thought of making the number a random variable (1,2,3,4,5) and including the variable name in the CSV:

/new.html?period=${RANDNUM}

which would then translate to '?period=1' , '?period=2', etc.

Unfortunately that doesn't work, as jmeter won't fill in the variable. I could remove the '/new.html' from my original CSV and make a separate request for that, using the RANDNUM variable, but perhaps there's a better way. Any advice is welcome!

regards,

Léon


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