3. Elements of a Test Plan

https://jmeter.apache.org/usermanual/test_plan.html

This section describes the different parts of a test plan.

A minimal test will consist of the Test Plan, a Thread Group and one or more Samplers.

3.0 Test Plan

The Test Plan object has a checkbox called "Functional Testing". If selected, it will cause JMeter to record the data returned from the server for each sample. If you have selected a file in your test listeners, this data will be written to file. This can be useful if you are doing a small run to ensure that JMeter is configured correctly, and that your server is returning the expected results. The consequence is that the file will grow huge quickly, and JMeter's performance will suffer. This option should be off if you are doing stress-testing (it is off by default).

If you are not recording the data to file, this option makes no difference.

You can also use the Configuration button on a listener to decide what fields to save.

 

3.1 Thread Group

Thread group elements are the beginning points of any test plan.

All controllers and samplers must be under a thread group.

Other elements, e.g. Listeners, may be placed directly under the test plan, in which case they will apply to all the thread groups.

As the name implies, the thread group element controls the number of threads JMeter will use to execute your test.

The controls for a thread group allow you to:

  • Set the number of threads
  • Set the ramp-up period
  • Set the number of times to execute the test

 

Each thread will execute the test plan in its entirety and completely independently of other test threads. Multiple threads are used to simulate concurrent connections to your server application.

The ramp-up period tells JMeter how long to take to "ramp-up" to the full number of threads chosen. If 10 threads are used, and the ramp-up period is 100 seconds, then JMeter will take 100 seconds to get all 10 threads up and running. Each thread will start 10 (100/10) seconds after the previous thread was begun. If there are 30 threads and a ramp-up period of 120 seconds, then each successive thread will be delayed by 4 seconds.

Ramp-up needs to be long enough to avoid too large a work-load at the start of a test, and short enough that the last threads start running before the first ones finish (unless one wants that to happen).

Start with Ramp-up = number of threads and adjust up or down as needed.

By default, the thread group is configured to loop once through its elements.

Thread Group also provides a scheduler. Click the checkbox at the bottom of the Thread Group panel to enable/disable extra fields in which you can enter the duration of test, the startup delay, the start and end times of the run. You can configure Duration (seconds) and Startup Delay (seconds) to control the duration of each thread group and the after how much seconds it starts. When the test is started, JMeter will wait Startup Delay (seconds) before starting the Threads of the Thread Group and run for the configured Duration (seconds) time. Note those 2 options override the Start time and End time.

Alternatively (although not recommended as not very flexible) you can use the two other fields Start time and End time. When the test is started, JMeter will wait if necessary until the start-time has been reached. At the end of each cycle, JMeter checks if the end-time has been reached, and if so, the run is stopped, otherwise the test is allowed to continue until the iteration limit is reached.

 

上一篇:【Luogu P1935】[国家集训队]圈地计划


下一篇:Python触发异常