The accepted answer in this thread is from 2014 and does not seem to work any more. I can't figure out why: JMeter. How to determine when thread group is finished
I have 2 threadgroups (ignore the setUp group)
Based on the accepted answer in the thread above I added
- A BeanShell Preprocessor
vars.put("DONE", "FALSE");
- A BeanShell Postprocessor
int activeThreadCount = org.apache.jmeter.threads.JMeterContextService.getNumberOfThreads(); if (activeThreadCount <= 1) { vars.put("DONE", "TRUE"); }
- A If Controller
${__BeanShell(vars.get("DONE") != null && vars.get("DONE")=="TRUE")};
- ... with a Flow Control Action terminating all threads via Stop now if triggered.
via print statements in the postprocessor I was able to verify that the variable "DONE" is correctly set and the condition vars.get("DONE") != null && vars.get("DONE")=="TRUE"
is evaluated correctly (when used in the postprocessor).
However when I use the condition inside of the If Controller it does not seem to be evaluated correctly no code inside of child elements of the If Controller is executed. The "Thred Group: ETL" just keeps on going even if the condition should evaluate to true.
My assumption would be that this has to do with the "Interpret Condition as Vairable Expression"-checkbox or the interpreter behind the If Controller. But unfortunately I don't know enough about JMeter to figure this out.
props
and notvars
– user7294900