JMeter interface pressure test example

Time:2020-9-9

JMeter interface pressure test example

Apache JMeter™YesApacheOrganization development of an open source software, is a typical pureJavaThe developed applications can be developed on different platforms, such asWindows 、 LinuxOrmacOSSoftware testing is carried out on the system.  JMeterIt is mainly used for functional load testing of applications to measure software performance, and can also be used for other types of tests, such as interface testingAPI testingEtc.

Download address:https://jmeter.apache.org/download_jmeter.cgi

Explain JMeter thread group in detail

 

 

 

Threads (users) thread users

  • Setup thread group routine thread group pre operation, such as login and registration before test
  • Teardown thread group general thread group post operation, such as log out for operation
  • Thread group (thread group) normal thread group interface test, we will use this to demonstrate

 

Join us, group. 642830685, get the latest software testing factory interview materials and python automation, interface, framework building learning materials! Communication with peers, technical experts answer questions

Thread group basic settings

 

 

 

  • Number of threads

The number of threads can be understood as concurrent numbers, they do not interfere with each other

  • ramp-up period

Set the time required to start all threads. We have set 100 threads and the ramp up period is 1 secondJmeterUse 1 second to start 100 threads, interval time between each thread = 1 / 100

The setting of this value is relatively small, and the number of threads is so large that the system load is relatively large. We can adjust it according to the machine

  • Number of cycles

Set the number of cycles for each thread before the end of the thread group. If it is set to 1, JMeter will only execute the test plan once before it stops, and the execution time of the loop is almost parallel to the execution time of the first time

 

 

 

HTTP request settings

 

 

 

 

 

 

Request response assertion

 

Assert the interface, if it is normalAPIIt’s very usefulJSONTo assert, here I will directly use the response code assertion

 

 

 

Synchronous timer concurrent test

Synchronous timer isjmeterA more important timer, synchronization timer, is equivalent to a savings pool. It accumulates certain requests. When a certain number of threads are reached within the specified time, these threads will be concurrent at the same time point, which can be used for concurrent requests with large amounts of data.

Recently, the company has developed a transfer function, which requires the most transfer interface to perform a concurrent test. When the balance of the account remains 10, two transfer requests are initiated at the same time. The amount of requests is 10. The test can be sent successfully. It is very difficult to do concurrent testing on our own words. We can also use this tool to test some necessary interfaces

 

 

  • Number of simulated user groups

The number of threads per release. If set to 0, it is equal to the number of threads in the thread lease. If it is set to 10, 10 threads are collected to wait and send the request at the same time. Set this number to no more than the number of threads in the thread group.

  • The timeout is in milliseconds

If set to 0TimerIt will wait for the number of threads to reach the value set in the number of simulated user groups before releasing. If it does not, it will wait until you manually close the execution. If it is greater than 0, if the maximum waiting time (in milliseconds) set in the timeout is exceeded and the value set in the number of simulated user groups is not reached, the timer will no longer wait and release the thread that has arrived. The default is 0

View test results