What is Jmeter? What are the principles and steps used by Jmeter?

1.1 What is JMeter

Apache JMeter is a Java-based stress testing tool developed by the Apache organization. Used for stress testing software, it was originally designed for web application testing, but has since been expanded to other testing areas. It can be used to test static and dynamic resources such as static files, Java servlets, CGI scripts, Java objects, databases, FTP servers, etc. JMeter can be used to simulate huge loads on servers, networks or objects, test their strength under different stress categories and analyze overall performance. In addition, JMeter can do functional/regression testing of your application by creating scripts with assertions to verify that your program returns the results you expect. For maximum flexibility, JMeter allows assertions to be created using regular expressions.

Apache jmeter can be used to test the performance of static and dynamic resources (files, Servlets, Perl scripts, Java objects, databases and queries, FTP servers, etc.). It can be used to simulate heavy loads on servers, networks or objects to test their strength or analyze overall performance under different stress types. You can use it to do graphical analysis of performance or test your servers/scripts/objects under large concurrent loads.

1.2 Why JMeter

Why choose JMeter? Let’s take a look at the features of JMeter.

1. Open source license: Jmeter is completely free and provides source code for custom development

2. Graphical interface mode: Provides a convenient graphical interface to edit and develop test scripts

3. Platform independent: can be easily run on windows, linux, mac

4. Multi-threading framework: Through thread groups, concurrent users for different tests can be easily set up.

5. Graphical test results: Provides result display in charts, tables, trees, files and other formats.

6. Easy to install: jmeter does not require installation, just download and unzip it.

7. High scalability: jmeter supports user-defined test scripts and also provides various plug-ins.

8. Support multiple test types: support performance testing, distributed testing, and functional testing

9. Simulation: supports multi-user concurrent testing

10. Multi-protocol support: supports http, jdbc, ldap, soap, jms, ftp and other protocols

11. Recording & playback: supports recording with badboy or jmeter

12. Script test: jmeter supports beanshell and selenium

现在我也找了很多测试的朋友,做了一个分享技术的交流群,共享了很多我们收集的技术文档和视频教程。
如果你不想再体验自学时找不到资源,没人解答问题,坚持几天便放弃的感受
可以加入我们一起交流。而且还有很多在自动化,性能,安全,测试开发等等方面有一定建树的技术大牛
分享他们的经验,还会分享很多直播讲座和技术沙龙
可以免费学习!划重点!开源的!!!
qq群号:110685036

1.3 JMeter working principle

The basic working principle of JMeter is as follows:

The complete working principle of JMeter is as follows:

1.4 Summary

This time I gave a simple basic introduction to jmeter, mainly to give everyone a basic understanding of jmeter.

The second JMeter directory and key configuration analysis

2.1 Preface

To learn a tool, you must first have a basic understanding of its key configurations and directories. This will make it easier to master the tool in depth. Below we will analyze and explain JMeter's directories and related key configurations.

2.2 Download and install

1. Install the main program

Download the latest version from the Apache JMeter official website:

http://jmeter.apache.org/download_jmeter.cgi

Just unzip it directly after downloading.

2. Install plug-in management

Download the plug-in management package from
https://jmeter-plugins.org/install/Install/  or  https://jmeter-plugins.org/downloads/all/  , as shown in the figure:

Place the downloaded package into lib/ext in the root directory of jmemter and then restart jmeter.

2.3 Directory description

First take a look at the decompressed JMeter installation directory:

Catalog description:

backups: Contains jmeter’s automatic backup and save of the test plan

 bin: Contains startup, configuration and other related commands

 docs: Official local documentation directory

 extras: auxiliary library

 lib: core library, including various basic libraries and plug-ins used by JMeter

 licenses: Contains licenses for non-ASF software

 printable_docs: Printable version documentation directory

 LICENSE: JMeter License Description

 NOTICE: JMeter simple information description

 README.md: Official basic introduction to JMeter

Next we focus on the bin directory, as shown in the figure:

Mainly introduces the files in the bin directory that we are most concerned about:

 jmeter.properties: JMeter core configuration file, various configurations are basically completed here

 log4j.conf: JMeter log configuration management

 jmeter.log: JMeter operation log record, all output information, warnings and errors are recorded here.

 jmeter.bat: jmeter startup file under windows

 shutdown.cmd: jmeter shutdown file under windows

 stoptest.cmd: jmeter test stop file under windows

 jmeter-server.bat: jmeter server mode startup file under windows

Note: Each .cmd file corresponds to a .sh file. .sh is a file with corresponding functions under Linux. The functions of other files will not be explained one by one. At the same time, other directories will not be explained here. Those who are interested can Take a closer look yourself.

2.4 Key configuration instructions

1. jmeter.properties configuration instructions

It mainly includes the following aspects of configuration:

SSL configuration:

Focus on the following configurations

#Specify HTTPS protocol layer

https.default.protocol=TLS

#Specify the SSL version, which may need to be modified in actual applications

https.default.protocol=SSLv3

# Set the startup protocol

https.socket.protocols=SSLv2Hello SSLv3 TLSv1

# Cache control, controls whether SSL can be reused in multiple iterations

https.use.cached.ssl.context=true

JMeter interface display configuration

The interface display control will not be explained here. Generally, the default interface can meet everyone's application.

JMeter test project automatic backup configuration

#Set whether to enable automatic backup, the default is true

jmeter.gui.action.save.backup_on_save=true

#Set the automatic backup directory. The default backup is to backups in the JMeter root directory.

jmeter.gui.action.save.backup_directory=

#Set the number of automatic backup items, the default is the latest 10

jmeter.gui.action.save.keep_backup_max_count=10

Remote host configuration

# Configure the IP of the remote host. The default is the local machine. Use commas "," to set multiple remote hosts

remote_hosts=127.0.0.1

# Examples of specifying multiple remote hosts are as follows, where: is followed by the port

remote_hosts=127.0.0.1:1099,127.0.0.1:1200,127.0.0.1:1300

For the configuration of RMID, please directly see the option description in the configuration file.

Log management configuration

# Set log format

log_format_type=default

#Set log output level

log_level.jmeter=INFO

#Set junit log output level

log_level.jmeter.junit=DEBUG

#Set the log output target file, the default is jmeter.log

log_file=jmeter.log

There are more than 10 other major configuration items (I won’t list them one by one).

jmeter.bat key configuration modifications

In order to use jmeter more optimally, some configurations in jmeter.bat need to be optimized according to the current machine configuration. Here are the key configuration items, find these configurations, and modify the values ​​​​in them according to the current machine hardware configuration.

set HEAP=-Xms2048m -Xmx2048m

set NEW=-XX:NewSize=512m -XX:MaxNewSize=512m

set SURVIVOR=-XX:SurvivorRatio=8 -

XX:TargetSurvivorRatio=50%

set TENURING=-XX:MaxTenuringThreshold=2

if %current_minor% LEQ "8" (

rem Increase MaxPermSize if you use a lot of Javascript in

your Test Plan :

set PERM=-XX:PermSize=512m -

XX:MaxPermSize=1024m

)

2.5 Start jmeter

Just double-click jmeter.bat in the bin directory.

The interface after startup is as follows:

2.6 Summary

This time, the installation and configuration of jmeter and key configuration items are shared. You can study other configurations in depth to further familiarize yourself with the principles and applications of jmeter.

Finally, I would like to thank everyone who read my article carefully. Looking at the increase in fans and attention, there is always some courtesy. Although it is not a very valuable thing, if you can use it, you can take it directly!

Software Testing Interview Document

We must study to find a high-paying job. The following interview questions are the latest interview materials from first-tier Internet companies such as Alibaba, Tencent, Byte, etc., and some Byte bosses have given authoritative answers. After finishing this set I believe everyone can find a satisfactory job based on the interview information.
 

Insert image description here

Guess you like

Origin blog.csdn.net/myh919/article/details/133279067