You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by praveen <pk...@gmail.com> on 2004/10/11 17:24:49 UTC

__Random function generates same random number

I want to create requests like 


http://somedomain.com/someArbitrarySesionString?name=RandomNumber



i have the following in the PATH field of my GET HTTP request.

${form_action_uri}?${__regexFunction((name=")(survey.q\d+)("
value="1"),$2$=${__Random(0,5,rand5)},ALL,&,null,nv_pairs)}


form_action_uri is the result of a previous regex processor that gets
the URI after the <form action= in a HTML response. This generates
http://somedomain.com/someArbitrarySesionString in the URI above.

In a given response on which this regexFunction works, there may be a
number of name-value pairs that are appended to the URI. When the URI
is finally constructed, I see that the result of __Random is always
the same value between 0 and 5.

How can I make __Random generate random values between 0 and 5 for the
construction of the same URI?

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


Re: __Random function generates same random number

Posted by sebb <se...@gmail.com>.
On Mon, 11 Oct 2004 10:24:49 -0500, praveen <pk...@gmail.com> wrote:
> I want to create requests like
> 
> http://somedomain.com/someArbitrarySesionString?name=RandomNumber
> 
> i have the following in the PATH field of my GET HTTP request.
> 
> ${form_action_uri}?${__regexFunction((name=")(survey.q\d+)("
> value="1"),$2$=${__Random(0,5,rand5)},ALL,&,null,nv_pairs)}
> 
> form_action_uri is the result of a previous regex processor that gets
> the URI after the <form action= in a HTML response. This generates
> http://somedomain.com/someArbitrarySesionString in the URI above.
> 
> In a given response on which this regexFunction works, there may be a
> number of name-value pairs that are appended to the URI. When the URI
> is finally constructed, I see that the result of __Random is always
> the same value between 0 and 5.
> 
> How can I make __Random generate random values between 0 and 5 for the
> construction of the same URI?

I don't think you can. 

The __Random() function is only evaluated once, when the RegexFunction
is establishing its parameters.

Try removing the random function from the regex, and use a ForEach
Controller to loop over all the values. You can then add the random
element in the ForEach Controller.

BTW, the __log() function is helpful in debugging, as is the Java Test
sampler - you can put all sorts of expressions in the Label and
elsewhere, and see the results in a Listener.

> 
> ---------------------------------------------------------------------
> 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