You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by warriorsf <wa...@gmail.com> on 2008/09/14 18:55:34 UTC

Variables in Test Plan

Hi Everyone

I'm very new to JMeter so please do not mind my naive questions. 

I want to do the following in my perf test plan:
- Log in to a website (figured this out)
- Navigate to a web page after logging in (figured this too)

What I cannot figure out:

- Use XPath to get a particular item from a table - I know how to generate
the XPath query.
- Once I get the XPath query value, I want to use that value in a HTTP POST
Request. 
- Lastly, I want to generate random numbers, but also store that generated
random number to use later. 

I'm using the UI to do all this since so if you can tell me how to do this
in the UI, that'd be very helpful.

Thanks a lot for all your help.
-- 
View this message in context: http://www.nabble.com/Variables-in-Test-Plan-tp19481847p19481847.html
Sent from the JMeter - User mailing list archive at Nabble.com.


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


Re: Variables in Test Plan

Posted by sebb <se...@gmail.com>.
On 14/09/2008, warriorsf <wa...@gmail.com> wrote:
>
>  Hi Everyone
>
>  I'm very new to JMeter so please do not mind my naive questions.
>
>  I want to do the following in my perf test plan:
>  - Log in to a website (figured this out)
>  - Navigate to a web page after logging in (figured this too)
>
>  What I cannot figure out:
>
>  - Use XPath to get a particular item from a table - I know how to generate
>  the XPath query.

Just add the XPath Extractor post processor as a child of the sampler.
Be sure to use a default value so you can be sure the XPath was applied.

>  - Once I get the XPath query value, I want to use that value in a HTTP POST
>  Request.

Use the variable as normal, e.g. ${XPATHVAR} or whatever you used.

>  - Lastly, I want to generate random numbers, but also store that generated
>  random number to use later.

You can use the Random function:
http://jakarta.apache.org/jmeter/usermanual/functions.html#__Random

e.g. put
${__Random(1,1000,MYRAND)}
on the first sampler that needs the number.

To re-use the number, use ${MYRAND}

Or you can use the User Parameters Pre-Processor with the random
function, for exampe:

Name     User_1
RAND    ${__Random(1,1000)}

and then use ${RAND} where you need to re-use it.

>
>  I'm using the UI to do all this since so if you can tell me how to do this
>  in the UI, that'd be very helpful.
>
>  Thanks a lot for all your help.
>
> --
>  View this message in context: http://www.nabble.com/Variables-in-Test-Plan-tp19481847p19481847.html
>  Sent from the JMeter - User mailing list archive at Nabble.com.
>
>
>  ---------------------------------------------------------------------
>  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