Jmeter assertion, parameterization and rendezvous

JMeter---QPS(Query Per Second)

QPS is the query rate per second. It is the number of queries that a query server can process per second. On the Internet, the performance of a domain name system server is often measured by the query rate per second.
Steps:
1. Add a thread group (learned before) Note: The parameter ramp-up period is used to tell JMeter how long it will take to create all threads. The default value is 0. If not specified, that is to say the ramp-up period is zero, JMeter will create all threads immediately, assuming the ramp-up period is set to T seconds and the total number of threads is set to N, JMeter will create a thread every T/N seconds . (The time unit in JMeter is milliseconds)
2. Add a sampler (request)
3. Add a timer - "Constant Throughput Timer (throughput timer), set QPS, and control the request throughput sent by a given sampler

target Throughput ( in samples per minute): target throughput. Note that the requirement here is the number of requests sent per minute, and the actual value is 60*QPS.
Calculate Throughput based on:

  • This thread only: Controls the throughput of each thread. When this mode is selected, the total throughput is the set target Throughput multiplied by the number of threads.
  • All active threads: The set target Throughput will be allocated to each active thread. Each active thread will run again after waiting for a reasonable time after the previous operation. Active threads refer to threads running at the same time.
  • All active threads (shared): It is basically the same as the option of All active threads, the only difference is that each active thread will run again after waiting a reasonable time after the previous running of all active threads.
  • All active threads in current thread group: The set target Throughput will be allocated to each active thread in the current thread group. When there is only one thread group in the test plan, this option has the same effect as the ALL active threads option.
  • All active threads in current thread group (shared): It is basically the same as All active threads in current thread group. The difference is that each active thread will run for a reasonable time after the last running of all active threads.

Select This thread only for this operation.
4. Add a listener - "View the result tree + aggregate report (concern about the request response time)
5. Run the script
6. Analyze the aggregate report
aggregate report items:

  • label: Each JMeter element (for example: HTTP Request) has a Name attribute, and the value of the Name attribute is displayed here
  • #samples: Indicates how many requests were made in this test.
  • Average: Average response time -- by default, it is the average response time of a single request. When a transaction controller is used, the average response time can also be displayed in transaction units.
  • Median: Median, which is the response time of 50% of users.
  • 90% Line: Response time for 90% of users.
  • Min: Minimum response time.
  • Max: The maximum response time.
  • Error%: The number of requests/total requests with errors in this test.
  • Throughput : Throughput--by default, it indicates the number of requests completed per S
  • KB/sec: The amount of data received from the server per S

 

JMeter affirmation

1. Response assertion (most commonly used)
2. Size Assertion: The assertion returns the size in bytes. Set the returned byte size. If the returned byte size does not match, the assertion fails, otherwise it succeeds.
3. Duration Assertion (Duration Assertion)
If the response time exceeds the set time, the assertion fails, otherwise it succeeds.
Add a listener - "Assertion result to check whether the assertion is successful
 
. Response to the relevant use of the assertion (open Baidu homepage):
Assertion success --- Assertion whether the returned data contains "Baidu"

View assertion results -- assertion success

 


Assertion failed---Assert whether the returned data contains "blog garden"

 

response assertion failed

 


 JMeter parameterization

Send the parameters together with the request. The parameter value is the reference value.
Three parameterization methods
1. User parameter
steps: 1) Preprocessor - "User Parameters -" Add Variable - "Name: user, value: ww
          2) In HTTP Parameters-"Add-" in the request: name, value: ${user} (parameter name is sent with the request, and the parameter value refers to the variable "user" in the user parameter)


        

The request failure can be ignored here, and the content of the sent request can be observed. The parameter name is included, and the value is the value of the variable user in the user parameter, indicating that the parameter is valid.

2. CSV data configuration --- read parameter content from file

 

File name: The path where the file is located (csv\txt)
File encoding: generally empty
Variable name (comma-separated in Western letters): The parameter items represented in the file, separated by commas, the name of the parameter item should be the same as The parameter items in the HTTP request are the same.

Others are as the name suggests. . . First, create a

new text (E:\test.txt) -- create three sets of data, the first column is the value of the variable user, and the second column is the value of the variable passwd.


Step:
Configure Components -> CSV Data Settings


 Set HTTP request parameters


3. Random parameterization - use the function assistant dialog box to generate a function and paste it into the HTTP request Parameters.

Click the icon to the left of the question mark in the toolbar (function assistant dialog box) - "Select a function" and select _Random to fill in the range of random numbers (1-5) - "Click "Generate" - "Copy the function string to HTTP The value of the variable name in the

request Parameters is a random number with a parameter value of 1-5 sent together with the request, which is generated by a function string.



Looking at the request in the result tree, the parameter value is 4.

 JMeter Collection

 

Set a few (multiple) users to operate together, such as setting a rendezvous point in seconds, in order to achieve absolute concurrency, and test the carrying capacity of the server. When all threads have reached the rendezvous point, the request is sent.

Implementation steps: Timer->Synchronizing Timer
Note: The rendezvous point must be placed in front of the component that needs the rendezvous point.
Set the rendezvous point: Synchronizing Timer's Number of Simulate Userd to Group by: 2---that is, set 2 concurrent users. There are 2 users to send the request.
Timout in millseconds: How many milliseconds to execute the HTTP request after the collection is complete.
1. When the number of threads is set to 4, 4 requests are sent, and every 2 requests are sent.

2. Set the number of threads to 3 and send 2 requests. The remaining thread cannot be assembled, so no request is sent.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324757851&siteId=291194637