Setup and Teardown Thread Group in Jmeter

setup和teardown有点类似于每个测试用例开始和结束时要做的动作

 

A Thread Group is the starting point of any Jmeter Test Plan. All the elements of a Test plan must be defined under Thread Group. In simple words, a thread group stores the configuration required for Jmeter script execution. Jmeter also provides feature to configure Setup Thread Group and TearDown Thread Group.

In this article we will discuss about the purpose and benefits of having Setup Thread Group and TearDown Thread Group.

If you are new to Jmeter and want to understand more about Thread Group, please click here: 5 must know features of Thread Group in Jmeter.

Setup Thread Group:

It is a special form of Thread Group used to perform necessary actions before execution of regular thread group starts. Behavior of threads mentioned under Setup Thread Group is exactly same as normal thread group.

setup_threadgroup

Purpose of having Setup Thread Group is to distinguish all pre-test actions from the normal thread group so they can be performed before the actual test execution starts. Jmeter automatically triggers Setup Thread group before normal one.

Example:

1) Import amount of Data from Database and store them into variables.
2) Create / Register multiple users to be used in Test Thread Group.

TearDown Thread Group:

It is a special form of Thread Group used to perform necessary actions after the execution of regular thread group completes. Behavior of threads mentioned under Setup Thread Group is exactly same as normal thread group.

Teardown Thread Group

Use of TearDown Thread Group is to differentiate all the post-test actions which are required to run once the execution of normal thread group is over. Jmeter will automatically trigger TearDown Thread Group after execution of regular thread group completes.

Note:

By default, TearDown Thread Group won’t run if the Test is completed as expected. If you want to run it anyway, mark the check-box “Run tearDown Thread Groups after shutdown of main threads” from Test Plan element.

Example:

1) Delete Users which were created in beginning of the test.

How to Add?

To add Setup and TearDown Thread Groups: Right Click on Test Plan > Add > Threads(User) > setUp Thread Group / tearDown Thread Group.

setup_teardown_threadgroup_Add

Let us know how you have used Setup and TearDown Thread Groups. Thank You & Happy Testing.

 

转载:http://www.testingjournals.com/setup-teardown-thread-group-jmeter/

转载于:https://www.cnblogs.com/shengulong/p/8118180.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值