Collections:
Override JMeter Variable from Command Line
How to Override a JMeter Variable from Command Line? I want to run the same test plan multiple times by changing the value of a variable I defined in the test plan.
✍: FYIcenter.com
JMeter command line does not allow you to override any variables
you defined in the test plan.
But it allows you to override any JMeter property. So you that you indirectly override a test plan variable through a JMeter property by following this tutorial.
1. Run JMeter and open "\fyicenter\Facebook-Login-Test-7.jmx".
2. Click on "Facebook Login Test Plan", and add a variable called "password".
Name: password Value: ${__P(pw,NoOneKnows)}
The expression in the value field, ${__P(pw,NoOneKnows)}, calls the JMeter built-in function __P(), which returns the value from a JMeter property called "pw", or "NoOneKnows" if the "pw" is not defined.
3. Click on "POST Login & Password" sampler, and update the "password" value to be "${password}, which takes the value from the test plan variable "password".
4. Save the test plan as "\fyicenter\Facebook-Login-Test-8.jmx" and run it from a command line twice. For the second run, "-J" option is used to provide value to a JMeter property.
>\fyicenter\jmeter\bin\jmeter -n -t Facebook-Login-Test-8.jmx (run the test plan with default password) >\fyicenter\jmeter\bin\jmeter -n -t Facebook-Login-Test-8.jmx -J pw=Abcd1234 (run the test plan with a given password)
Now you can repeat the test with different passwords at the command line.
The picture below shows you how to use the "-J" command line option to override a JMeter property, which can be passed to a test plan variable:
⇒ Call JMeter Command in Windows Batch
⇐ Run JMeter Test Plan in Command Line
2017-12-04, 9092🔥, 0💬
Popular Posts:
How to generate test fractional numbers? Test fractional numbers are numbers with fractions that are...
How to validate and decode MAC (Media Access Control) addresses? In order to help your programming o...
Where to find test data generators? FYIcenter.com has prepared a number of test data generators for ...
How to generate currency test values? Currency test values are frequently needed in testing date and...
How to Pass Windows Environment Variable to JMeter? I want to use Windows temporary folder environme...