JMeter.如何确定线程组何时完成 [英] JMeter. How to determine when thread group is finished

查看:211
本文介绍了JMeter.如何确定线程组何时完成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要运行两个单独的线程组(第二个线程组具有无限循环数).当第一组完成后,停止第二组.我该如何确定第一小组何时完成?

I need two separate thread groups to be run(Second group have infinite loop count). And when the first group is done stop the second one. How can I determine when the first group is done?

推荐答案

这对我有用:

  • 使用以下代码创建"BeanShell预处理程序":
    props.put("DONE", "FALSE");
  • 使用以下代码创建"BeanShell PostProcessor":
    int activeThreadCount = org.apache.jmeter.threads.JMeterContextService.getNumberOfThreads(); if (activeThreadCount <= 1) { props.put("DONE", "TRUE"); }
  • Crete "BeanShell PreProcessor" with this code:
    props.put("DONE", "FALSE");
  • Create "BeanShell PostProcessor" with this code:
    int activeThreadCount = org.apache.jmeter.threads.JMeterContextService.getNumberOfThreads(); if (activeThreadCount <= 1) { props.put("DONE", "TRUE"); }

使用以下内容添加If Controller:
${__BeanShell( props.get("DONE") != null && props.get("DONE")=="TRUE")}

Add If Controller with:
${__BeanShell( props.get("DONE") != null && props.get("DONE")=="TRUE")}

在If Controller中停止当前线程.

Stop Current Thread inside If Controller.

这篇关于JMeter.如何确定线程组何时完成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆