Jmeter with Seperate Scenario file

I wanted to start running the same Jmeter test plan but for different scenario i.e. number of users etc. I had setup all the paramters in a user defined variables and changed these between run but this lead to seperate test plan files with different scenarios. The problem any change to the plan other than the variables needed to be replicated across all the test plan. There for I wanted a file that can included in the command line call when invoking Jmeter and at the same time I still wanted the ability to set the paramter via the GUI.

To do this I used the __P property function. The line below will use the pUser property if it is defined via the command line if it is not ie. from a plan invocation of the GUI it will use the value 20.

${__P(pUser,20)}

Here is an example in a dummy test plan

set4scenario

Next I needed to set up a properties file containing the property / value pairs. In this example I created a file peak.properties with a single line.

pUser=1000

Then to run this from the command line I insert the -q peak.properties following to the command line.

jmeter -n -t MyTestPlan.jmx -q peak.properties

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s