title: Executing Specific JMeter Thread Groups in a Test Plan
body: <p>I have read through the similar posts with the same question as mine, but there wasn't enough detail for me to figure it out. So I was wondering if someone could correct what I'm doing wrong. And as the question states I want to run a single Thread Group from a Test plan using the CLI.</p>
  
  <p>So my Test Plan contains 4 Thread Groups. Each Thread Group is the exact same except the Cookie Manager in each Thread Group contains a different value for a specific Cookie. So when I run from the command line I want to tell JMeter to only Execute Thread Group 1 or 2 or 3 etc... What I read so far is that you can use a While Controller and a Variable to accomplish this, but I can't seem to get it to work.</p>
  
  <p><strong>My Test Plan Looks like this:</strong></p>
  
  <pre> 
  + Test Plan - Logging-In
     + Thread Group - Server 1 Login
         - While Controller <em>(*with variable "server1ThreadActive")</em>
         - HTTP Request Defaults
         - Cookie Manager
         + HTTP Request - Load Homepage
         + HTTP Request - Load Login Page
         + HTTP Request - Login Form
         + HTTP Request - Do something
         + HTTP Request - Do something else
         + HTTP Request - Logout
     + Thread Group - Server 2 Login
         - While Controller <em>(*with variable "server2ThreadActive")</em>
         - HTTP Request Defaults
         - Cookie Manager
         + HTTP Request - Load Homepage
         + HTTP Request - Load Login Page
         + HTTP Request - Login Form
         + HTTP Request - Do something
         + HTTP Request - Do something else
         + HTTP Request - Logout
  </pre>
  
  <p>So the Test Plan above has 2 more of the exact same Thread Groups for Server 3 and 4 as you could imagine... Do I have the While loops configured in the correct locations?
  <br><br></p>
  
  <h2><strong>--FIRST TRY--</strong></h2>
  
  <p><strong><em>While Controllers:</em></strong> 1st I had the conditions set to this below for each respective Thread:</p>
  
  <pre>   <strong>Condition (function or variable) =</strong> "${__P(server1ThreadActive)}" == "false"</pre>
  
  <p><strong><em>Command Line:</em></strong> Then to try and execute only Thread for Server 2 I would use this on the CLI:</p>
  
  <pre>   jmeter -n -t Server_Login.jmx -Jserver1ThreadActive=true</pre>
  
  <p><strong><em>RESULT:</em></strong> This resulted in all 4 Threads executing when I only was trying to run Server 2 Thread.</p>
  
  <h2><strong>--SECOND TRY--</strong></h2>
  
  <p><strong><em>While Controllers:</em></strong> 2nd I had the conditions set to this below for each respective Thread:</p>
  
  <pre>   <strong>Condition (function or variable) =</strong> ${__P(server1ThreadActive)}</pre>
  
  <p><strong><em>Command Line:</em></strong> Then to try and execute only Thread for Server 2 I would use this on the CLI, assuming that without a value assignment in while controller it defaults to true, so I set all vars to false except the one I want to run:</p>
  
  <pre>   jmeter -n -t Server_Login.jmx -Jserver1ThreadActive=false -Jserver3ThreadActive=false -Jserver4ThreadActive=false</pre>
  
  <p><strong><em>RESULT:</em></strong> This resulted in all 4 Threads executing when I only was trying to run Server 2 Thread.</p>
  
  <p>There was a few other things that I tried as well but I am assuming they were wrong too since I had the same result. I had also tried adding a User Defined Variables section and creating 4 vars, but couldn't figure that out either... I even tried creating a file called "Server_Login.properties" and inserted those variable names, one on each line with the value set to false for each one, and included it on the command-line with the <strong>-S</strong> option, but no such luck...</p>
  
  <p>Could anyone tell me where I am going wrong with this?
  Any thoughts or suggestions would be greatly appreciated!</p>
  
  <p>Thanks in Advance,<br>
  Matt</p>