JMeter is a Java technology stack tool, which is widely used in the field of software testing. Whether performance testing or interface testing, the technology is very mature and stable. It has a prominent feature: open source, suitable for secondary development, represented by Ali Java technology stack companies are favored by it. Before JMeter, the tool I first came into contact with was LoadRunner. After graduation, I also bought a book called “Proficient in Software Performance Testing and The Best Practice of LoadRunner”, but its time has passed:

Screenshot from TesterHome discussion post.

This is the age of JMeter, and the JMeter series will be based on a book called JMeter In Action for Full Stack Performance Testing. This paper introduces the structure of JMeter, and forms an overall cognition and preliminary impression of JMeter after reading it. In order to facilitate the following explanation, two terms are clarified:

  • Components: Such as HTTP requests, transaction controllers, and response assertions, are a component.

  • Component: A logical controller, for example, is a component. A component contains one or more components.

Big components, small components, not so rigorous, you want to call control can! Let’s take a look at the JMeter structure diagram in component terms:

X, Y and Z form a three-dimensional space.

X1~X5 represents: 5 simulation processes.

Y1 indicates the user request.

Y2 stands for: result verification.

Z stands for: result collection.

X1 [sampler]

By accessing the test plan | | thread group add Sampler Sampler.

Think of it as a browser without an interface, sending requests and receiving responses. Supports HTTP requests, WebService requests (SOAP/ xml-rpc), and Java requests. Protocols include HTTP, FTP, JAVA, LDAP, MAIL, MongoDB, SMTP, SOAP, TCP, and Junit. You can also write BeanShell scripts, a java-like scripting language.

X1 [assertion]

Through the test plan | add Assertions Assertions. Thread groups can also add assertions.

Response Assertion is common. You can write BeanShell to implement custom complex assertions.

X1 [Listener]

Through the test plan | add Listener Listener. Thread groups can also add listeners.

Can be used to show results. For example, see The Result tree (View Results True) to View each request and response. Aggregate Reports are similar to test reports.

Alternatively, you can save the test result data to a file for re-analysis.

X2 [Preprocessor]

By adding the Pre test plans | front processor Processors. Thread groups can also add prehandlers.

Before sending a request, you need to do some environmental or data preparation, which requires a preprocessor. For example, before performing operations on a database, you need to establish a database connection.

X2 [Configuration components]

Can pass the test planning | configuration Element to add Config Element. Thread groups can also add configuration elements.

It provides configuration data for the sampler. For example, use CSV Data Set Config to read test Data from a file. For example, using functions (function assistants) to generate dynamic data. For example, HTTP Cookie Manager is used to automatically record the Cookie information returned by the server. For example, using User Defined Variables, preset initialization Variables.

X2 [Rear processor]

Can pass the test planning | Post processor to add Post Processors. Thread groups can also add a post-processor.

Its purpose is to process the response data. Regular Expression Extractor, for example, uses Regular expressions to match response results and extract partial data.

X3 [logic controller]

You can pass the test program Logic Controller | | thread group to add Logic Controller.

It is used to control the processing logic. For example, if you Only log in Once, you can use Once Only Controller.

X4 [Timer]

Can pass the test plan to add Timer Timer | | thread group.

It is used to set the waiting time. For example, wait five seconds before sending the request. Such as waiting for multiple requests to be sent at the same time.

Different timers have different functions.

X5 [Thread group]

You can pass the test plan to add Threads | thread group (Users).

Threads(Users) are both Threads and Users. JMeter simulates one user per thread.

Test Fragment

Can pass the Test planning | Test fragments added. Thread groups can also be added.

Can be used for temporary backup components, components under Test Fragment will not be run. Encapsulation can be called by the module controller, just like programming.

summary

This article starts with the JMeter architecture diagram and describes the JMeter architecture through component screenshots. Samplers, assertions, and listeners combine to send requests, validate results, and log results. The preprocessor, the configuration element, and the post-processor all provide data support for the sampler. Logical controllers can fulfill a variety of requirements. The timer can set the meeting point and waiting time, etc. JMeter is modeled with thread groups, where a thread is a user. Test Fragment can be used to back up components, and the components underneath will not be run.

References:

Full Stack Performance Test JMeter Practice

testerhome.com/topics/8599