On 3/27/07, sebb <[EMAIL PROTECTED]> wrote:
Thanks for your help, Sebb.

I found another way to do this that's awkward, but allows for random
selection and doesn't involve an extra file.  I describe here in case
anyone else finds it useful.

Let's say we want to randomly pick one of val_1, val_2, and val_3.
First, we assign each of these values to a differently-named property
with __setProperty in some suitable place (e.g., the User Defined
Variables at the Test Plan level):

${__setProperty(parm_1, val_1,)}
${__setProperty(parm_2, val_2,)}
${__setProperty(parm_3, val_3,)}

Then, we generate the suffix for the parameter name using __Random,
and use __property to look up the value of the parameter with that
suffix:

${__property(parm_${__Random(1,3,)})}

This feels like an abuse of properties, but I can't figure out a way
to dynamically compute the name of a variable and then retrieve its
value... e.g., I can't do

${var_${suffix}}

and there doesn't seem to be a function that takes a variable's name
and returns its value.

Probably __StringFromFile and/or CSV Data Set Config are the way to
go, although it'd be nice to have randomness.


            Scott


                     Scott

Create a file with the values in random order, and then use CSV
DataSet or __StringFromFile() to read it.

S.
On 27/03/07, Scott Cederberg <[EMAIL PROTECTED]> wrote:
> Hi JMeter folks,
>
>   Is there a way to set a request parameter to a value chosen at
> random from a prespecified list?  I suppose one way to accomplish the
> same thing would be with a Random Logic Controller that has one child
> sampler for each possible parameter value, but that seems awkward and
> possibly inefficient for the number of possible values I'm hoping to
> use.
>
>   Thanks for your help.
>
>
>           Scott
>
> ---------------------------------------------------------------------
> 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