• 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/

  • 相关阅读:
    tkinter 类继承的三种方式
    tkinter 的两个例子
    python 测试驱动开发的简单例子
    python 播放 wav 文件
    Python 操作 MongoDB
    【转】如何拿到半数面试公司Offer——我的Python求职之路
    scrapy 保存到 sqlite3
    scrapy 爬取 useragent
    收集的User-Agent
    scrapy 登录
  • 原文地址:https://www.cnblogs.com/shengulong/p/8118180.html
Copyright © 2020-2023  润新知