You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by denis boutin <db...@c-log.com> on 2010/11/02 19:59:06 UTC

Read a cookie value inside Jmeter 2.4

Hi,

I'm trying to read a cookie value inside JMeter2.4. Do you know how can 
I do that  ?

I've tried using a cookie manager which works well. However now in a 
certain part of my scenario I'd like to read a value of a cookie. So 
I've tried various solution, however none of them were successfull.
Direct acess to ${JSESSIONID} which is the name of the cookie correctly 
filled. However, the ${JSESSIONID} return ${JSESSIONID} and not the 
content of cookie

With an regexp extractor this is the same thing
Nom de référence : gna
Expression régulière : JSESSIONID=(.*)
Canevas : $1$

Test avec un postProcesseur beanshell :
System.out.println("test");
System.out.println("${JSESSIONID}"); // return ${JSESSIONID}
System.out.println("toto");
System.out.println(vars.get("JSESSIONID")); // null
System.out.println("cookie count : " + 
sampler.getCookieManager().getCookieCount()); // not executed probably 
due to bad syntax...

Blured.



---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: Read a cookie value inside Jmeter 2.4

Posted by Mariusz W <ma...@gmail.com>.
have you tried:
SESSIONID=(.*?);

and use ${mysessionID}
if you have Reference Name : mysessionID

it should contain "6959ea68" for example - use Debug Sampler as mentioned
earlier to check if value is ok.

On Thu, Dec 16, 2010 at 11:43 AM, Deviran <ka...@gmail.com> wrote:

>
> I tried SESSIONID too, still getting the default value.
>
>
> i just used 'COOKIE_xx' as mentioned in the doc.
>
>
> http://jakarta.apache.org/jmeter/usermanual/component_reference.html#HTTP_Cookie_Manager
>
> Pls help.
>
> Thanks,
> Devi.
> --
> View this message in context:
> http://jmeter.512774.n5.nabble.com/Read-a-cookie-value-inside-Jmeter-2-4-tp3247250p3307723.html
> Sent from the JMeter - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>

Re: Read a cookie value inside Jmeter 2.4

Posted by Deviran <ka...@gmail.com>.
Yes, i checked the Debug Sampler, i am able to see the COOKIE_SESSIONID
value.
I used ${COOKIE_SESSIONID} directly to set a parameter value without using
regular expression.
 i am getting the value.

Thanks a lot for your help.

Regards,
Devi.
-- 
View this message in context: http://jmeter.512774.n5.nabble.com/Read-a-cookie-value-inside-Jmeter-2-4-tp3247250p3307806.html
Sent from the JMeter - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: Read a cookie value inside Jmeter 2.4

Posted by Mariusz W <ma...@gmail.com>.
I don't use this feature also but after enabling it I see in Debug Sampler:
COOKIE_JSESSIONID=3B153CADD0FC756E14B35CE563BB7D87

where JSESSIONID I get in set-cookie.

On Thu, Dec 16, 2010 at 11:54 AM, Felix Frank <ff...@mpexnet.de> wrote:

> On 12/16/2010 11:43 AM, Deviran wrote:
> >
> > I tried SESSIONID too, still getting the default value.
> >
> >
> > i just used 'COOKIE_xx' as mentioned in the doc.
> >
> >
> http://jakarta.apache.org/jmeter/usermanual/component_reference.html#HTTP_Cookie_Manager
>
> Interesting. I didn't know Cookie Manager can do that.
>
> Have you added CookieManager.save.cookies=true to the properties file?
>
> If so, you don't need the regex extractor at all, if I'm reading this
> correctly.
>
> Use the Debug Sampler to find out exactly what variables are populatet
> by the Cookie Manager.
>
> Regards,
> Felix
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>

Re: Read a cookie value inside Jmeter 2.4

Posted by Felix Frank <ff...@mpexnet.de>.
On 12/16/2010 11:43 AM, Deviran wrote:
> 
> I tried SESSIONID too, still getting the default value.
> 
> 
> i just used 'COOKIE_xx' as mentioned in the doc.
> 
> http://jakarta.apache.org/jmeter/usermanual/component_reference.html#HTTP_Cookie_Manager

Interesting. I didn't know Cookie Manager can do that.

Have you added CookieManager.save.cookies=true to the properties file?

If so, you don't need the regex extractor at all, if I'm reading this
correctly.

Use the Debug Sampler to find out exactly what variables are populatet
by the Cookie Manager.

Regards,
Felix

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: Read a cookie value inside Jmeter 2.4

Posted by Deviran <ka...@gmail.com>.
I tried SESSIONID too, still getting the default value.


i just used 'COOKIE_xx' as mentioned in the doc.

http://jakarta.apache.org/jmeter/usermanual/component_reference.html#HTTP_Cookie_Manager

Pls help.

Thanks,
Devi.
-- 
View this message in context: http://jmeter.512774.n5.nabble.com/Read-a-cookie-value-inside-Jmeter-2-4-tp3247250p3307723.html
Sent from the JMeter - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: Read a cookie value inside Jmeter 2.4

Posted by Felix Frank <ff...@mpexnet.de>.
On 12/16/2010 11:15 AM, Deviran wrote:
> 
> example cookie below,
> 
> Cookie Data:
> SESSIONID=6959ea68; $Path=/;

Err - then why on earth does your regex say COOKIE_SESSIONID instead of
SESSIONID ?!

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: Read a cookie value inside Jmeter 2.4

Posted by Deviran <ka...@gmail.com>.
example cookie below,

Cookie Data:
SESSIONID=6959ea68; $Path=/;

Request Headers:
Accept-Language: en-us
Accept-Encoding: gzip, deflate
.
.
.


i will check how to use the Debug Sampler.

Thank you for the help,
Devi.
-- 
View this message in context: http://jmeter.512774.n5.nabble.com/Read-a-cookie-value-inside-Jmeter-2-4-tp3247250p3307685.html
Sent from the JMeter - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: Read a cookie value inside Jmeter 2.4

Posted by Felix Frank <ff...@mpexnet.de>.
On 12/16/2010 09:24 AM, Mariusz W wrote:
> hi,
> Can you get some exemple cookie from your test? I also think that this
> regexp - COOKIE_SESSIONID=(.+?) - will give you only first  letter from all
> cookie.

Fair assumption.

Also, using a Debug Sampler is highly recommended.

> On Thu, Dec 16, 2010 at 8:10 AM, Deviran <ka...@gmail.com> wrote:
> 
>>
>> Hi,
>>
>> I am trying to get the COOKIE value using the Regular Expression Extractor
>> as follows,
>>
>> I have set the 'Response Field to check ' to Headers.
>> Reference Name : mysessionID
>> Regular Expression : COOKIE_SESSIONID=(.+?)
>> Template : $1$
>> Match No. : 1
>> Default Value : 11111111
>>
>> I am getting the value as ${mysessionID}. I get only '11111111'.
>>
>> I have also tried, Regular Expression : ${COOKIE_SESSIONID}
>>
>> What's wrong. I appreciate your help.

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: Read a cookie value inside Jmeter 2.4

Posted by Mariusz W <ma...@gmail.com>.
hi,
Can you get some exemple cookie from your test? I also think that this
regexp - COOKIE_SESSIONID=(.+?) - will give you only first  letter from all
cookie.

On Thu, Dec 16, 2010 at 8:10 AM, Deviran <ka...@gmail.com> wrote:

>
> Hi,
>
> I am trying to get the COOKIE value using the Regular Expression Extractor
> as follows,
>
> I have set the 'Response Field to check ' to Headers.
> Reference Name : mysessionID
> Regular Expression : COOKIE_SESSIONID=(.+?)
> Template : $1$
> Match No. : 1
> Default Value : 11111111
>
> I am getting the value as ${mysessionID}. I get only '11111111'.
>
> I have also tried, Regular Expression : ${COOKIE_SESSIONID}
>
> What's wrong. I appreciate your help.
>
> Thanks,
> Devi.
>
>
> --
> View this message in context:
> http://jmeter.512774.n5.nabble.com/Read-a-cookie-value-inside-Jmeter-2-4-tp3247250p3307487.html
> Sent from the JMeter - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>

Re: Read a cookie value inside Jmeter 2.4

Posted by Deviran <ka...@gmail.com>.
Hi,

I am trying to get the COOKIE value using the Regular Expression Extractor
as follows,

I have set the 'Response Field to check ' to Headers.
Reference Name : mysessionID
Regular Expression : COOKIE_SESSIONID=(.+?)
Template : $1$
Match No. : 1
Default Value : 11111111

I am getting the value as ${mysessionID}. I get only '11111111'.

I have also tried, Regular Expression : ${COOKIE_SESSIONID}

What's wrong. I appreciate your help.

Thanks,
Devi.


-- 
View this message in context: http://jmeter.512774.n5.nabble.com/Read-a-cookie-value-inside-Jmeter-2-4-tp3247250p3307487.html
Sent from the JMeter - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: Read a cookie value inside Jmeter 2.4

Posted by denis boutin <db...@c-log.com>.
Thanks a lot it works perfectly

Le 02/11/2010 20:55, sebb a écrit :
> On 2 November 2010 18:59, denis boutin<db...@c-log.com>  wrote:
>> Hi,
>>
>> I'm trying to read a cookie value inside JMeter2.4. Do you know how can I do
>> that  ?
>>
>> I've tried using a cookie manager which works well. However now in a certain
>> part of my scenario I'd like to read a value of a cookie. So I've tried
>> various solution, however none of them were successfull.
>> Direct acess to ${JSESSIONID} which is the name of the cookie correctly
>> filled. However, the ${JSESSIONID} return ${JSESSIONID} and not the content
>> of cookie
> That's because the JSESSIONID variable is not defined.
> Also, cookies are called COOKIE_cookiename, see:
>
> http://jakarta.apache.org/jmeter/usermanual/component_reference.html#HTTP_Cookie_Manager
>
>> With an regexp extractor this is the same thing
>> Nom de référence : gna
>> Expression régulière : JSESSIONID=(.*)
>> Canevas : $1$
> You need to set the RE extractor source to the Headers.
>
>> Test avec un postProcesseur beanshell :
>> System.out.println("test");
>> System.out.println("${JSESSIONID}"); // return ${JSESSIONID}
>> System.out.println("toto");
>> System.out.println(vars.get("JSESSIONID")); // null
>> System.out.println("cookie count : " +
>> sampler.getCookieManager().getCookieCount()); // not executed probably due
>> to bad syntax...
>>
>> Blured.
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>>
>>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>




---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: Read a cookie value inside Jmeter 2.4

Posted by sebb <se...@gmail.com>.
On 2 November 2010 18:59, denis boutin <db...@c-log.com> wrote:
> Hi,
>
> I'm trying to read a cookie value inside JMeter2.4. Do you know how can I do
> that  ?
>
> I've tried using a cookie manager which works well. However now in a certain
> part of my scenario I'd like to read a value of a cookie. So I've tried
> various solution, however none of them were successfull.
> Direct acess to ${JSESSIONID} which is the name of the cookie correctly
> filled. However, the ${JSESSIONID} return ${JSESSIONID} and not the content
> of cookie

That's because the JSESSIONID variable is not defined.
Also, cookies are called COOKIE_cookiename, see:

http://jakarta.apache.org/jmeter/usermanual/component_reference.html#HTTP_Cookie_Manager

> With an regexp extractor this is the same thing
> Nom de référence : gna
> Expression régulière : JSESSIONID=(.*)
> Canevas : $1$

You need to set the RE extractor source to the Headers.

> Test avec un postProcesseur beanshell :
> System.out.println("test");
> System.out.println("${JSESSIONID}"); // return ${JSESSIONID}
> System.out.println("toto");
> System.out.println(vars.get("JSESSIONID")); // null
> System.out.println("cookie count : " +
> sampler.getCookieManager().getCookieCount()); // not executed probably due
> to bad syntax...
>
> Blured.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


RE: Read a cookie value inside Jmeter 2.4

Posted by Uma N <um...@cspl.com>.
Please unsubscribe

-----Original Message-----
From: denis boutin [mailto:dboutin@c-log.com] 
Sent: Wednesday, November 03, 2010 12:29 AM
To: jmeter-user@jakarta.apache.org
Subject: Read a cookie value inside Jmeter 2.4

Hi,

I'm trying to read a cookie value inside JMeter2.4. Do you know how can 
I do that  ?

I've tried using a cookie manager which works well. However now in a 
certain part of my scenario I'd like to read a value of a cookie. So 
I've tried various solution, however none of them were successfull.
Direct acess to ${JSESSIONID} which is the name of the cookie correctly 
filled. However, the ${JSESSIONID} return ${JSESSIONID} and not the 
content of cookie

With an regexp extractor this is the same thing
Nom de référence : gna
Expression régulière : JSESSIONID=(.*)
Canevas : $1$

Test avec un postProcesseur beanshell :
System.out.println("test");
System.out.println("${JSESSIONID}"); // return ${JSESSIONID}
System.out.println("toto");
System.out.println(vars.get("JSESSIONID")); // null
System.out.println("cookie count : " + 
sampler.getCookieManager().getCookieCount()); // not executed probably 
due to bad syntax...

Blured.



---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: Read a cookie value inside Jmeter 2.4

Posted by sebb <se...@gmail.com>.
On 3 November 2010 07:21, Uma N <um...@cspl.com> wrote:
> Please unsubscribe

Unsubscribe instructions are at the end of every posting.

> -----Original Message-----
> From: denis boutin [mailto:dboutin@c-log.com]
> Sent: Wednesday, November 03, 2010 12:29 AM
> To: jmeter-user@jakarta.apache.org
> Subject: Read a cookie value inside Jmeter 2.4
>
> Hi,
>
> I'm trying to read a cookie value inside JMeter2.4. Do you know how can
> I do that  ?
>
> I've tried using a cookie manager which works well. However now in a
> certain part of my scenario I'd like to read a value of a cookie. So
> I've tried various solution, however none of them were successfull.
> Direct acess to ${JSESSIONID} which is the name of the cookie correctly
> filled. However, the ${JSESSIONID} return ${JSESSIONID} and not the
> content of cookie
>
> With an regexp extractor this is the same thing
> Nom de référence : gna
> Expression régulière : JSESSIONID=(.*)
> Canevas : $1$
>
> Test avec un postProcesseur beanshell :
> System.out.println("test");
> System.out.println("${JSESSIONID}"); // return ${JSESSIONID}
> System.out.println("toto");
> System.out.println(vars.get("JSESSIONID")); // null
> System.out.println("cookie count : " +
> sampler.getCookieManager().getCookieCount()); // not executed probably
> due to bad syntax...
>
> Blured.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org