JMeter dynamic set of thread groups and parameters during non-GUI mode runtime

Source: Internet
Author: User

When you use JMeter for performance test automation, you may have the following requirements:

1. Specify how many threads to run, and how many times to run;

2. The destination address of the access has changed and the port has changed and needs to be specified again.

This is not a problem if the above requirements are working in a GUI way, and it is possible to modify the script directly.

However, performance test automation is run in a non-GUI manner, and it can be cumbersome to modify a test plan.

Here's how to solve these problems simply:

1. Specify how many threads to run

We know that the JMeter test plan loads the run properties (jmeter.properties,system.properties, etc.) before running sampler, so we can do that with attributes.

Of course, we are not stupid enough to modify these configuration files, which is much more troublesome. JMeter provides a way to modify properties dynamically, using-j at the command line to specify JMeter properties

(Jmeter.bat-help | Jmeter.sh-help can see HELP), use the __p () function to get the property value specified in the command.

Take a look at the example:

Jmeter.bat-jthreadcount=2-jcycle=2-n-T Baidu.jmx-l baidu.jtl

threadcount=2 the number of threads to specify for the BAIDU.JMX test plan

-jcycle=2 the number of iterations per thread to be specified for the BAIDU,JMX test plan

Use ${__p (ThreadCount,)} in the BAIDU.JMX test plan to get the value of ThreadCount, ${__p (cycle,)} to get the value of cycle.

The results are as follows:

2. The destination address of the access has changed and the port has changed, re-specified:

The JMeter command line specifies the system properties through-D, similar to the JDK we use-D to specify some of the systems attributes, such as turning on JMX remote monitoring.

In the JMeter script we use the __property () function, such as-durl=www.baidu.com in the test plan with ${__property (URL,,)} to get

Run the command as follows:

Jmeter.bat-jthreadcount=2-jcycle=2-durl=www.baidu.com-dport=80-n-T Baidu.jmx-l baidu.jtl

The script is as follows:

Using-j-d to dynamically set properties before running can be used to control the execution of a test plan, which is convenient when running in non-GUI mode.

Natural performance Test Automation We can use these command-line parameters to dynamically specify properties, no more scripts to modify.

Reprint to: http://mp.weixin.qq.com/s?__biz=MjM5Mjg0MzMzMw==&mid=212445083&idx=2&sn= 15ea97c18f485441f81cce518a0256b2&scene=1&srcid=09132wlotujuurwcpymoogwm&key= Dffc561732c226515ef41e246271369d0cc6918c66e3b6308bb0ff1d4ad1613691de68bfd1bda18d07189d35d0e3b91f&ascene=1 &uin=mji2njmxmjuymw%3d%3d&devicetype=windows+7&version=6102002a&pass_ticket=ianfcji5nai8zaj% 2bqcw1%2bqnvnqqn9kclq98itkycagbhkbjamfnnvc23cpkwntj6

JMeter dynamic set of thread groups and parameters during non-GUI mode runtime

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.