Social Icons

Pages

Tuesday, 7 October 2014

How to pass command line arguments to JMeter when executed from command line

How to Execute JMeter from Command line:


How to Pass Arguments:

In most of JMeter test plans, their will be some dynamic values which will change will different executions like server IP address, admin credentials etc.
So, you will need to pass these dynamic value from command line and use these values in test plan.


Passing Arguments:

jmeter.bat -n -t <test plan name with path> -J<proprtyName>=<argument value>

Example:

jmeter.bat -n -t test_plan.jmx -JserverIP=10.0.0.1

Steps to Use passed argument in JMeter: 
  1. Add a element named 'User Defined Variables' from test plan->add->Config Element as the top element of test plan.
  2. Go to 'User Defined Variables' element.
  3. In name field, add name of variable(say var) in which command line argument will be stored.
  4. In value field, add ${__property(argName)} where argName will be passed from command line.
  5. For more arguments, repeat steps 3-4.
After execution of above element in jmeter, var will contain the value passed from command line with propery name 'argName'.

No comments:

Post a Comment

Please Comment for Any question or suggestions