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, ≈10🔥, 0💬
Popular Posts:
How to see my IP address Host Name? To help you to see your IP Address Host Name, FYIcenter.com has ...
How to generate test fractional numbers? Test fractional numbers are numbers with fractions that are...
How to generate date and time test values? Timestamp values are frequently needed in testing almost ...
In what order thread groups are executed in JMeter? Thread groups, including regular "Thread Groups"...
Where to find tutorials on Apache JMeter test tool? I want to know how to use Apache JMeter. Here is...