title: JMeter - Using Variables in CookieManager?
body: <p>I have been reading just about everything I can find on CookieManager and JMeter Variables and Properties and I just can't seem to get it working or if this will even work.</p>
  
  <p>What I want to do is to be able to set the Cookie i want to use on the Command Line and/or from a .properties file.</p>
  
  <p>Inside my Cookie Manager I have manually added one Cookie like so:</p>
  
  <pre><code>CookieManager:
  NAME  |       VALUE          |    DOMAIN     |  PATH
  ------+----------------------+---------------+--------
  MYID  | ${__P(myCookie.var)} |  mydomain.com |   /        
  </code></pre>
  
  <p>Then, what I tried to do was pass a value for "myCookie.var" on the CLI using:</p>
  
  <pre><code>-J "myCookie.var=srv1"
  </code></pre>
  
  <p>to set the Cookie <em>"MYID"</em>, but when I run the case the Cookie is set to <em>'null'</em>...
  <br></p>
  
  <hr>
  
  <p>When the above did NOT work I tried adding a User Defined Variables element to the Test Plan. I added one variable with <em>NAME = "myVar"</em>, and the value set to <em>VALUE = "${__P(myCookie.var)}"</em>. Then, in the CookieManager I set it as:</p>
  
  <pre><code>CookieManager:
  NAME  |  VALUE   |    DOMAIN     |  PATH
  ------+----------+---------------+-------
  MYID  | ${myVar} |  mydomain.com |   /        
  </code></pre>
  
  <p><br>
  So, after running my Test Plan and checking the variables in a BeanShell I can see that the User-Defined Variable <em>"myVar"</em> is receiving the variable I pass on the Command-Line, but the Cookie <em>"MYID"</em> is still being set to <strong><em>'null'</em></strong>...</p>
  
  <p>Are Cookie Managers allowed to use variables as the Cookie's VALUE?</p>
  
  <p>Thanks in Advance,<br>
  Matt</p>