JmeterIntroduction: An excellent open-source performance testing tool.
Advantages: When you use it, you will find its many advantages. Of course, its shortcomings will also be shown.
Principles of Performance Tools:
The jmeter tool and other performance tools are exactly the same in principle. The tool consists of four parts:
(1) load generator: used to generate loads. It is usually used to simulate user behavior in multi-thread or multi-process mode.
(2) User Runner: generally a script running engine. The user runner is attached to a thread or process and simulates specified user behaviors according to the script requirements.
(3) Resource generator: used to generate resource data of servers and load servers during testing.
(4) Report builder: Generate reports based on the data in the test to provide a visual data display mode.
Test Plan Components
Test Plan): Describes a performance test, including all functions related to this performance test. That is to say, all the content of this performance test is based on a plan.
Next, let's take a look at the main functional modules under the next plan (right-click the "test plan" pop-up menu ).
Threads (users) thread user
Although there are three options for adding a thread group with different names, the interface is identical after creation. The previous version only has the name of a thread group. Now there is one more setup theread group and terdown thread group.
1) setup thread group
A special type of threadgroup that can be used to perform pre-test operations. These threads act like a normal thread group component. The difference is that these types of threads perform regular thread group execution before testing.
2) teardown thread group.
A special type of threadgroup that can be used to perform post-test actions. These threads act like a normal thread group component. The difference is that these types of threads execute regular thread groups after testing.
Maybe you still don't quite care about the differences between them and common thread groups. If you have used JUnit, you may not be unfamiliar with setup or teardown. It does not matter if it is used in real time. Familiar with LoadRunner, we should know that the LoadRunner script is not only the core content of the real script in the action, but also the initialization script for initializing the "Environment" and the script block for clearing information after the test. Here, setup thread group and teardown thread group respectively refer to these two parts. In essence, they are no different.
3) thread group (thread group ).
This is the thread we usually add to run. Generally speaking, a thread group can be considered as a virtual user group. Every thread in the thread group can be considered as a virtual user. The number of threads in the thread group will not change during the test execution.
Test Fragment)
The test snippet is a new option added after version 2.5.
The test fragment element is a special thread group on the controller. It is in a level with the thread group on the test tree. It is different from a thread group because it is not executed unless it is a module controller or is referenced by a controller.
Controller
Jmeter has two types of controllers: The sample and logic controller, which are used to drive a test.
Sampler)
The sample is the minimum unit for sending requests to the server, recording the response information, and recording the response time in the performance test. jmeter native supports multiple sampler types, for example, HTTP request sampler, FTP request sample, TCP request sample, and JDBC request sampler. Different types of sampler can send different types of requests to the server according to the set parameters. (Among all samplers of jmeter, Java request sampler and beanshell request sampler are two special And customizable sampler types, which will be discussed in detail later .)
Logic Controller)
Logical Controller, including two types of component-less controllers. One is the controller used to control the logical sequence of requests sent by sampler nodes in test plan) controller, switch controller, runtime controller, and loop controller. Another type is used to organize nodes that can control sampler, such as transaction controllers and throughput controllers.
Config Element)
Config element is used to support static data configuration. CSV Data Set config can form a data pool for local data files. If there is no configuration item corresponding to HTTP request sampler and TCP request sampler, the default sampler data can be modified. (For example, HTTP cookie manager can be used to manage HTTP request sampler cookies)
Timer (timer)
The timer (timer) is used to set the wait time between operations. The wait time is a commonly used hand end for controlling the client QPS in performance testing. Similar to the "thinking time" in LoadRunner ". Jmeter defines different types of timer, such as bean shell timer, constant throughput timer, and fixed timer.
Preprocessor (per processors)
It is used to process the request to be sent before the actual request is sent. For example, the http url rewriting fix can be used to rewrite the URL. When rul contains session information such as sessionid, it can be used to fill in the actual sessionid of the request.
Post Processors)
It is used to process the server response after the sampler sends a request. It is generally used to extract specific data in the response (similar to the association concept in the LoadRunner test tool ). For example, the XPath extractor can be used to extract the data obtained by the given XPath value in the response data.
Assertions)
Assertions are used to check whether the data obtained in the test meets expectations. assertions are generally used to set checkpoints to ensure that the data interaction during the performance test is consistent with expectations.
Listener (listener)
This listener is not a component used to listen to system resources. It is a series of components used to process and visualize the test result data. Graph row result, view result tree, and aggregate report. These are all frequently used components.
At this point, we have a brief understanding of the basic components of jmeter, and our subsequent performance testing work is to use these components to complete the test task.
Link:
Jmeter basics-recording script
----------------------------------------------------------------------------------
I have been busy recently and often work overtime. I have no time to talk to my friends in the group. Recently I have been reading some basic software testing books. I want to read some insights from the books or see some good knowledge points to share them with you. You can forget the content in the book. I don't know whether the selected test book is poor or because of the poor working pressure. One day, or one month later, I even forced myself to gain something.
Performance testing has always been the main axis of my learning this year. Other knowledge I learned is centered around this main axis. In the beginning of this blog, I introduced the use of jmeter. After more than a year, I once again picked up my enthusiasm for jmeter and shared it with you.