【问题标题】:Jmeter: Is it possible to run a particular thread group after all the other thread group gets completedJmeter:是否可以在所有其他线程组完成后运行特定线程组
【发布时间】:2017-02-05 02:09:16
【问题描述】:

在 JMeter 中,我有一个要求,我想在所有其他线程组完成运行后运行特定线程组,我知道 tearDown 线程组具有类似的行为,但不幸的是,逻辑必须是我的一部分常规线程。

假设我的测试计划中有 4 个线程组 A、B、C 和 D,我希望线程组 D 仅在 A、B 和 C 完成运行后执行。

我们能否在不使用“设置、拆卸和一次运行一个组”的情况下实现这一目标??

问题截图:

【问题讨论】:

  • 这是面试题吗?

标签: jmeter performance-testing load-testing beanshell blazemeter


【解决方案1】:

我可以建议 2 个选项:

  1. 使用Inter-Thread Communication Plugin。详情请见example test plan
  2. 如果由于某种原因您无法使用 JMeter 插件,您可以使用 JMeter 属性实现相同的功能,例如:

    • 当线程组 A 完成设置 JMeter 属性时,即 ThreadGroupADone=true 使用 __setProperty() 函数,如

      ${__setProperty(ThreadGroupADone,true,)}
      
    • 在线程组 D 中:

      • 在线程组的开头添加While Controller,并使用以下条件:

        ${__javaScript("${__P(ThreadGroupADone,)}"=="false",)}
        
      • Test Action 采样器添加为While Controller 的子代,并将其配置为暂停合理的秒数,即每5 秒暂停5 秒,而控制器将检查ThreadGroupADone 属性值以及它是否仍为false - 再睡 5 秒。当属性值变为true - 线程组 D 将继续。

【讨论】:

    猜你喜欢
    • 2022-11-27
    • 1970-01-01
    • 1970-01-01
    • 2015-03-22
    • 1970-01-01
    • 2023-04-09
    • 2021-07-11
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多