On 18/05/2009, Anders Eurenius <[email protected]> wrote:
> Hi
>
>  I have a bit of a problem: the site I'm trying to test uses js to frob a
>  cookie to communicate state, so I'd really like to be able to do that in
>  my test as well. Setting a cookie manager cookie to a script fragment
>  doesn't seem to do it, particularly since I don't want to magically have
>  the cookie before the server sets it. In short:
>
>  ...
>  jmeter: req /able  (no cookie.)
>  server: ok,        cookie: fnord=1234deadbeef
>  ...magic goes here...
>  jmeter: req /baker cookie: fnord=1234deadbeef,{"json":"wierdness"}
>  server: ok...
>  ...
>
>  Using a BSF preprocessor to clobber the variable-by-that-name doesn't
>  seem to work. (I'm guessing it just creates a new variable that shadows
>  the cookie.)

Cookie values are copied to variables but the Cookie Manager does not
use the variable when sending cookies.

>  I could start hacking in Java, but I'd prefer to avoid it.

You will need to write some code.

The only way to change the value of a cookie is to either write your
own copy of the Cookie Manager, or write a Pre-Processor that changes
the value stored by the Cookie Manager.

You can get to the Cookie Manager using sampler.getCookieManager().
After that you'll need to find the cookie and change its value. See
the CookieManager code for details.

Or you could just add a new Cookie with the appropriate details.

>  Thank you.
>
>  Anders Eurenius
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: [email protected]
>  For additional commands, e-mail: [email protected]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to