Set Up and Tear Down are virtual users (or threads in the JMeter language) that will execute before or after the main virtual user. They can be used to conduct preparation or cleaning actions that would be otherwise harder to schedule properly.
A 10 minutes test using both would have an Active users curve like this:
As you can see Set Up threads add up to the overall duration of your tests. Make sure to leave room for them to execute otherwise the Main threads might be stopped earlier at the end of the planned duration. Tear Down threads on the other hand will execute at the end of the planned duration.
Most of the settings on this screen are similar to what you can configure for the main virtual user, so we will only look at the ones specific to Set Up/Tear Down users. Please refer to the load and policies pages for information on others.
The time spent in setup thread groups will be taken out of the total testing time, so make sure to take this into account when planning your tests. A good practice is to use the lifetime parameter to control how long it will last.
You have two options for the scope:
Localmeans every load generator during the test will execute a local Set Up/Tear Down
Globalmeans we will execute the Set Up/Tear Down on one load generator only, this is useful to conduct a unique action for the entire test.
Number of concurrent users¶
Here again two options:
Onemeans only one virtual user will be run. (or one per load generator if the scope is
Same as main VUmeans one Set Up/Tear Down per main virtual user (based on the maximum number specified in the load section), this is useful if you need to create a unique value for each user of the main virtual user. This allows a Ramp-up period to be selected.
Virtual user iteration behavior¶
Start from scratchto get rid of cache and cookies every iteration,
Keep cache and cookiesto keep them when running several iterations.
Virtual user end¶
Choose to end after the planned
VU Duration or after the
Max iterations is reached
Virtual user lifetime¶
This value define the minimum AND maximum duration of each Set Up/Tear Down user.
It is a very good tool to control how much time is allocated for those. Otherwise the main virtual user could be delayed indefinitely if one of the Set Up/Tear Down users times out.
For example for a Set Up user with a ramp up of
1 minute and
2 minutes of lifetime, you know the main virtual user will start after
2 + 1 = 3 minutes have passed. And that way you can predict the time allocated to the main user for this test.
A more detailed explanation is that:
- Since it is a minimum duration, each Set Up/Tear Down user that would finish before reaching that time will wait until
lifetimeduration has been reached,
- Since it is a maximum duration, each Set Up/Tear Down user that would not be done when
lifetimeduration has been reached will be forcefully shutdown.