Review of Jmeter Pressure Tests (Part 2)
The menus in this section are commonly used. Functions that are not commonly used by individuals are ignored.
Test plan menu introduction
Thread (user)
- Thread group: The thread group element is the starting point for any test plan. All controllers and samplers must be under thread groups
- SetUp ThreadGroup: a special type of ThreadGroup that can be used to perform pre-trial operations. These threads behave exactly like a normal thread group element. The difference is that these types of threads perform periodic thread group execution before performing tests.
- Teardown ThreadGroup: of a special type of ThreadGroup that can be used to perform post-test actions. These threads behave exactly like a normal thread group element. The difference is that these types of threads execute regular thread groups after the test ends.
If you don’t understand this, see Junit’s setup, teardown
The configuration element
The Config element is used to provide support for static data configuration. CSV Data Set config can form local Data files into Data pools, and configuration components corresponding to HTTP Request Sampler and TCP Request Sampler can modify the default Data of Sampler. (For example, HTTP Cookie Manager can be used to manage cookies in the HTTP Request Sampler.)
Listener:
Listeners, as the name implies, are used to listen for test results, and you can see that different listeners need to be configured for each request. The most common functions are to view result trees and aggregate reports, which will be used in the following functions:
Timer:
Timer has not been personally practiced, skip…
Preprocessor:
Used for special processing of incoming requests before the actual request is issued. For example, the HTTP URL rewrite fix allows URL rewriting, and when there is session information such as a sessionID in the RUL, the handler can be used to populate the actual sessionID of the request.
Rear processor:
Used to process the server response after the Sampler makes the request. Typically used to extract specific data from a response (similar to the association concept in the LoadRunner test tool). For example, XPath Extractor can be used to extract data from the response data that is obtained with a given XPath value.
Assertion:
Assertions are used to check whether the corresponding data obtained during the test meets expectations. Assertions are generally used to set checkpoints to ensure that data interaction during the performance test is consistent with expectations.
Note that the assertion applies to all samplers in its scope. To limit the declaration to a single sampler, add the declaration as a child of the sampler.
Test snippet:
The Test fragment element is a special type of controller that sits at the same level of the Test Plan tree as the thread group element. It differs from thread groups in that it does not execute unless referenced by the module controller or Include_Controller. This element is used only for code reuse in test plans
Non-test components:
You can find the Http proxy server Settings and configure the Http proxy to facilitate concurrent testing on the proxy server.
Starting sequence of each component:
- Configuration elements
- The preprocessor
- The timer
- sampler
- Post-processor (unless SampleResult is
null
) - Assertion (unless SampleResult is
null
) - Listener (unless SampleResult is
null
)
Note that timers, assertions, preprocessors, and postprocessors are only processed if there is a sampler applicable to them. Logical controllers and samplers are processed in the order in which they appear in the tree. Other test elements are processed based on their discovery scope and the type of the test element. Within a type, elements are processed in the order in which they appear in the tree.
Thread group menu introduction:
Sampler:
The sampler tells JMeter to send the request to the server and wait for the response. They are processed in the order in which they appear in the tree. The controller can be used to modify the number of repetitions of the sampler.
The JMeter sampler includes:
- FTP request
- HTTP requests (also available for SOAP or REST Web services)
- JDBC requests
- Java object request
- JMS request
- JUnit tests the request
- LDAP requirements
- Email request
- Operating system process request
- TCP requests
Remember to add a listener to your test plan, otherwise the end result will not be visible
Logic controller:
The logical controller allows you to customize the logic JMeter uses to determine when to send requests. To understand the impact of the logical controller on your test plan, consider the following test tree
Test Plan
Thread Group
Once Only Controller
- Login Request (an HTTP Request)
Load Search Page (HTTP Sampler)
Interleave Controller
- Search “A” (HTTP Sampler)
- Search “B” (HTTP Sampler)
- HTTP default request (Configuration Element)
HTTP default request (Configuration Element)
Cookie Manager (Configuration Element)
As you can see, a variety of complex requests can be combined using a logical controller.