Passing global parameters to a jmx file

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Vic
Reply | Threaded
Open this post in threaded view
|

Passing global parameters to a jmx file

Vic
Is there an easy way to pass user defined parameters (such as server, port, thread count, duration) to a jmeter test from the command line?

I have been struggling with this problem for some time now. Here is what I have tried:

I have a shell script that takes arguments for server, port, threads, and duration parameters. It then writes them to a temporary csv file. It then excecutes the jmeter test which pulls the values from the csv using a top level "csv data set config" element.

The problem is that the "threads" and "duration" values don't get passed down to the child "thread group" in my test, which expects them in the "Number of threads" and "Duration (seconds)" fields. I can't seem to figure out why. The "server" and "port" values work when accessed in the "HTTP Request Defaults" element (a child of the thread group). Does the scope of those variables only apply to children of the thread groups?
Reply | Threaded
Open this post in threaded view
|

Re: Passing global parameters to a jmx file

sebb-2-2
You can define properties on the command-line using the -J
property=value qualifier, and then refer to them using the __P()
function:

http://jakarta.apache.org/jmeter/usermanual/functions.html#__P

S.
On 22/11/06, Vic <[hidden email]> wrote:

>
> Is there an easy way to pass user defined parameters (such as server, port,
> thread count, duration) to a jmeter test from the command line?
>
> I have been struggling with this problem for some time now. Here is what I
> have tried:
>
> I have a shell script that takes arguments for server, port, threads, and
> duration parameters. It then writes them to a temporary csv file. It then
> excecutes the jmeter test which pulls the values from the csv using a top
> level "csv data set config" element.
>
> The problem is that the "threads" and "duration" values don't get passed
> down to the child "thread group" in my test, which expects them in the
> "Number of threads" and "Duration (seconds)" fields. I can't seem to figure
> out why. The "server" and "port" values work when accessed in the "HTTP
> Request Defaults" element (a child of the thread group). Does the scope of
> those variables only apply to children of the thread groups?
> --
> View this message in context: http://www.nabble.com/Passing-global-parameters-to-a-jmx-file-tf2689686.html#a7500470
> Sent from the JMeter - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Vic
Reply | Threaded
Open this post in threaded view
|

Re: Passing global parameters to a jmx file

Vic
Thank you... that's precisely what I needed. For the curious, here is what I did:

The command looked like this:

jmeter -n mytest.jmx -Jserver=qa.test.com -Jport=80 -Jthreads=100 -Jduration=120

And in my top level "User Defined Variables" in the test, I specified:

server=${__P(server)}
port=${__P(port)}
threads=${__P(threads)}
duration=${__P(duration)}

sebb-2 wrote
You can define properties on the command-line using the -J
property=value qualifier, and then refer to them using the __P()
function:

http://jakarta.apache.org/jmeter/usermanual/functions.html#__P

S.
On 22/11/06, Vic <vic@pandora.com> wrote:
>
> Is there an easy way to pass user defined parameters (such as server, port,
> thread count, duration) to a jmeter test from the command line?
>
> I have been struggling with this problem for some time now. Here is what I
> have tried:
>
> I have a shell script that takes arguments for server, port, threads, and
> duration parameters. It then writes them to a temporary csv file. It then
> excecutes the jmeter test which pulls the values from the csv using a top
> level "csv data set config" element.
>
> The problem is that the "threads" and "duration" values don't get passed
> down to the child "thread group" in my test, which expects them in the
> "Number of threads" and "Duration (seconds)" fields. I can't seem to figure
> out why. The "server" and "port" values work when accessed in the "HTTP
> Request Defaults" element (a child of the thread group). Does the scope of
> those variables only apply to children of the thread groups?
> --
> View this message in context: http://www.nabble.com/Passing-global-parameters-to-a-jmx-file-tf2689686.html#a7500470
> 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