Search code examples
jmeterthreadgroup

JMeter. How to determine when thread group is finished


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?


Solution

  • That's work for me:

    • 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"); }

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

    Stop Current Thread inside If Controller.