title: Get number of threads in a thread group from the setup thread group (jmeter)
body: <p>I have a JMeter test plan which performs a simple action once. </p>
  
  <p>The problem I am having is that my test setup needs to know how many threads the thread group will have. To make things clearer, here is a simple representation of the test plan:</p>
  
  <pre><code>setUp Thread Group
    needs to know the number of threads in the below thread group
  Thread Group
    The number of threads for this thread group is determined via the "Number of Threads (users)" Thread Property.
  </code></pre>
  
  <p>I can dynamically get the number of threads from within the thread group, but I can't find any way of getting this number from within the setup thread group instead.</p>
  
  <p>Any ideas?</p>
  
  <p>Ideally I was hoping to find something like <code>${__groovy(ctx.getTestPlan().getThreadGroupByIndex(1).getNumThreads())}</code>, but I can't find anything of the sort.</p>
  
  <p>To be clear, I'm looking for the number of threads as assigned directly in JMeter in the Thread Group properties. This question has absolutely nothing to do with BlazeMeter and is therefore <strong>not</strong> a duplicate of <a href="https://stackoverflow.com/questions/43500371/get-number-of-threads-defined-via-blazemeter-in-a-thread-group-from-the-setup">Get number of threads (defined via BlazeMeter) in a thread group from the setup thread group (jmeter)</a></p>