Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Jmeter environment configuration and precautions (1)

2025-04-12 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

Install jdk and configure environment variables

Download the installation package, archive.apache.org/dist/jmeter/binaries/

Unzip locally, not in Chinese directory, and open jmeter.bat under bin directory

Configure jmeter environment variables:

Create a new system variable JMETER_HOME, the value is the decompression path, such as D:\apache-jmeter-4.0

Edit the Path variable and add;%JMETER_HOME%\bin

Enter jmeter -v in cmd

5. jmeter.bat file: modify memory parameters to prevent memory overflow set HEAP=-Xms1g -Xmx1g(4.0 default 1G, 3.0 default 512M, maximum half of physical memory)

6. Language and interface settings

Modify the configuration file, jmeter.properties, language=zh_CN, restart jmeter to take effect

Modify UI theme, option--appearance, select different styles

7. structure

7. Cycle times, you can set a specific number of times

8. Scheduler, need to be combined with cycle times set to "always" use. The scheduler can be used to do stability tests, usually more than 8 hours.

9. badboy record script, and then export script for jmeter use, need to check the following 2 items, avoid js error during recording

10. Select Follow Redirect

11. Check "Coding"

12. If there is Chinese in the request,"utf-8" is required

13. If the data format of the post request is json/xml, then use: Body Data

If it is json, you must add--configuration component--HTTP header manager, Content-Type=application/json

14. File upload, HTTP header manager must be set, Content-Type=multipart/form-data

15. HTTP cookie manager

Modify the jmeter.properties file:

CookieManager.save.cookies=true #Change this to true and restart jmeter

16. Gets the value of the cookie variable

Get cookie values in scripts by COOKIE_cookie name, for example

log.info ("${COOKIE_JSESSIONID}"); parameters in request use ${COOKIE_JSESSIONID}

If there are multiple thread groups, global variables may be used, common cookies, as follows

First get the value of JSESSIONID using vars.get, then props.put into the global variable

17. HTTP header manager

More realistic simulation of browser behavior; can also simulate mobile apps, Mini programs and other applications

When the request body is json, Content-Type=application/json must be added.

18. Responding to assertions, checkpoints

Assertion object, can be the response result, can also be the request content, default to the following configuration can be

Pattern matching rules:

Including: partial matching, support regular

Match: Perfect match, regular support

Equals: exact match, case-sensitive, regular not supported

Substring: Partial match, case-sensitive, regular not supported

No: used in combination with the previous items, negated

Or: used in combination with the previous items, take or

19. Listeners-View Result Tree

Modify the configuration file, jmeter.propered.

Result analysis procedure:

Request name displayed in green for success and red for failure (checkpoint required)

First look at whether the content returned by the server in the response data is correct

See if the content sent in the request is correct

Auxiliary information in the final reference sampler result

You can choose the format, such as HTML, which is more convenient to read.

You can set the storage location of the result data in the file name, and set the stored data content through Configure. The file format can be jtl, xml, csv.

Check Log Error Only to display error result information only

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report