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, 9109🔥, 0💬
Popular Posts:
How to generate user full names? Test user names are frequently needed in testing applications that ...
How to Open and Close Internet Explorer with UFT script? One way to open and close Internet Explorer...
How to validate email address format? In order to help your programming or testing tasks, FYIcenter....
How to call JMeter command in a Windows batch file? I want to create a single batch job to run JMete...
How to use HTTP protocol to post an XML message to a server? You can follow this tutorial to post an...