You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by timvanderet <ti...@yahoo.com> on 2008/06/26 22:33:44 UTC

Cookie not recognized

Hi everyone. I new to Jmeter so excuse me if my vocabulary is a bit off. I
know there are a lot of posts regarding cookies, but even after extensive
searching I couldn't get my question solved.

I used a HTTP Proxy Server to record my actions in firefox. I logged into a
site, created an event on a calendar, and logged out.

There are 3 different cookies used doing this process (confirmed by firebug)
Before login there is a "j session id" and after login there is a second "j
session id" and a "j user id" The two j session ids are being recorded and
sent properly. However the j user id isn't being recognized as a cookie.
according to the listener tree when Jmeter sends the request to login (posts
all my login info), the response data is the value of the j session id.
However it doesn't get recognized or stored as a cookie. Furthermore, in all
of the subsequent HTTP requests there is a parameter with name: "context id"
and value:"12145XXXX" (the same value returned earlier, which was confirmed
to be j user id in firebug)

When running the test in Jmeter the login repeatedly fails so I'm assuming
this cookie issue is the problem. Does anyone have any insight into this?

thanks so much
-- 
View this message in context: http://www.nabble.com/Cookie-not-recognized-tp18142357p18142357.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: Cookie not recognized

Posted by sebb <se...@gmail.com>.
On 01/07/2008, timvanderet <ti...@comcast.net> wrote:
>
>  I was able to log in after making a few adjustments. When i was recording the
>  test through the proxy, the cookie that wasn't being recognized was being
>  passed as a parameter in all of the http requests.

Then it's not really a cookie ...

>  I replaced this hard
>  coded value (the value of the cookie during the session it had been
>  recorded) with the jUserId variable we extracted earlier. Although this
>  isn't an ideal solution, I dont know how else to make it work, but it does
>  work.

Presumably the browser was doing this using some Javascript; the
solution seems fine to me.

>  Thanks so much for all the help and patience. I realize I should probably
>  have a better understanding of what I'm doing before i ask questions, but
>  I'm jsut trying to learn as much as I can.
>
> --
>  View this message in context: http://www.nabble.com/Cookie-not-recognized-tp18142357p18220891.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
>
>

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


Re: Cookie not recognized

Posted by timvanderet <ti...@comcast.net>.
I was able to log in after making a few adjustments. When i was recording the
test through the proxy, the cookie that wasn't being recognized was being
passed as a parameter in all of the http requests. I replaced this hard
coded value (the value of the cookie during the session it had been
recorded) with the jUserId variable we extracted earlier. Although this
isn't an ideal solution, I dont know how else to make it work, but it does
work. 

Thanks so much for all the help and patience. I realize I should probably
have a better understanding of what I'm doing before i ask questions, but
I'm jsut trying to learn as much as I can.
-- 
View this message in context: http://www.nabble.com/Cookie-not-recognized-tp18142357p18220891.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: Cookie not recognized

Posted by sebb <se...@gmail.com>.
On 30/06/2008, timvanderet <ti...@comcast.net> wrote:
>
>  >
>  >
>  >
>  Oops, overlooked that bit:
>
>  Servers send Set-Cookie
>  Browsers send Cookie
>
>  as can be seen from the Tree View Listener.
>
>
>
>
>
>
> I changed the name of the header in the http header manager from
>  "set-cookie" to "cookie" meaning the header manager now looks like this:
>  Name: cookie Value: JUSERCOOKIE=${jUserId}
>
>  Now there is no evidence of any sort of request being sent. Before the http
>  tree showed a request "set-cookie: JUSERCOOKIE=139283..." Now after the
>  change there is no request shown, and the cookie still doesn't show up in
>  the list under "Cookie Data"

The Header Manager does not send a request; it just provides headers
for the samplers in scope.

The cookie won't show up under Cookie Data because it is being treated
as a header, not a cookie.

> --
>  View this message in context: http://www.nabble.com/Cookie-not-recognized-tp18142357p18200737.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
>
>

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


Re: Cookie not recognized

Posted by timvanderet <ti...@comcast.net>.
>
>
>
Oops, overlooked that bit:

Servers send Set-Cookie
Browsers send Cookie

as can be seen from the Tree View Listener.





I changed the name of the header in the http header manager from
"set-cookie" to "cookie" meaning the header manager now looks like this:
Name: cookie Value: JUSERCOOKIE=${jUserId}

Now there is no evidence of any sort of request being sent. Before the http
tree showed a request "set-cookie: JUSERCOOKIE=139283..." Now after the
change there is no request shown, and the cookie still doesn't show up in
the list under "Cookie Data"
-- 
View this message in context: http://www.nabble.com/Cookie-not-recognized-tp18142357p18200737.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: Cookie not recognized

Posted by sebb <se...@gmail.com>.
On 27/06/2008, timvanderet <ti...@comcast.net> wrote:
>
>  the cookie value is being extracted properly, however the response header
>  isn't properly storing it as a cookie.
>  The response tree shows the following request is being sent set-cookie:
>  JUSERCOOKIE=121459...
>  However this doesnt seem to do anything. In later requests that cookie isn't
>  listed under "Cookie Data" where the two Jsession cookies are. Furthermore
>  the Login continues to fail.
>
>  any idea what the problem could be?
>

Oops, overlooked that bit:

Servers send Set-Cookie
Browsers send Cookie

as can be seen from the Tree View Listener.

> --
>  View this message in context: http://www.nabble.com/Cookie-not-recognized-tp18142357p18163565.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
>
>

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


Re: Cookie not recognized

Posted by timvanderet <ti...@comcast.net>.
the cookie value is being extracted properly, however the response header
isn't properly storing it as a cookie.
The response tree shows the following request is being sent set-cookie:
JUSERCOOKIE=121459...
However this doesnt seem to do anything. In later requests that cookie isn't
listed under "Cookie Data" where the two Jsession cookies are. Furthermore
the Login continues to fail.

any idea what the problem could be?
-- 
View this message in context: http://www.nabble.com/Cookie-not-recognized-tp18142357p18163565.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: Cookie not recognized

Posted by sebb <se...@gmail.com>.
On 27/06/2008, timvanderet <ti...@comcast.net> wrote:
>
>  Sorry for all of the questions. Thanks for being so patient in answering
>  them, it is very much appreciated. Login still isn't working so Im gonna
>  write everything i have to see if I'm close.
>
>  I have a regex extractor as the child of the HTTP request which is posting
>  the login info
>  Response Field to check: Response code

No - the response code is 200 or 404 etc.

Use Body.

>  Ref name: jUserId
>  reg expression: .+
>  Template: $0$
>  Match no: 1
>
>  Then I put a header manager in the child of the following http request.
>  name: set-cookie
>  value: JUSERCOOKIE=jUserId
>

That should be

value: JUSERCOOKIE=${jUserId}

>
>  Questions:
>  1. Are my regex extractor and header manager set up correctly?

No, see above.

>  2. Is the header manager in the right place?

Yes.

>  3. Should I get read of this parameter in all of the following requests:
>  name- contextId value- (value of juserid cookie when recorded through
>  proxy)?

No idea what you are  asking here.

I suggest you try the suggested corrections and see how you get on.

> --
>  View this message in context: http://www.nabble.com/Cookie-not-recognized-tp18142357p18161886.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
>
>

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


Re: Cookie not recognized

Posted by timvanderet <ti...@comcast.net>.
Sorry for all of the questions. Thanks for being so patient in answering
them, it is very much appreciated. Login still isn't working so Im gonna
write everything i have to see if I'm close.

I have a regex extractor as the child of the HTTP request which is posting
the login info
Response Field to check: Response code
Ref name: jUserId
reg expression: .+
Template: $0$
Match no: 1

Then I put a header manager in the child of the following http request.
name: set-cookie
value: JUSERCOOKIE=jUserId


Questions:
1. Are my regex extractor and header manager set up correctly?
2. Is the header manager in the right place?
3. Should I get read of this parameter in all of the following requests:
name- contextId value- (value of juserid cookie when recorded through
proxy)?
-- 
View this message in context: http://www.nabble.com/Cookie-not-recognized-tp18142357p18161886.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: Cookie not recognized

Posted by sebb <se...@gmail.com>.
On 27/06/2008, timvanderet <ti...@comcast.net> wrote:
>
>  ok so a couple of questions about regex extractor. Should it be a child of
>  the HTTP Request which is posting the login info or should it just come
>  after it?
>

Child.

>  I also don't know what to put in the "Regular expression" or "template"
>  field. It doesn't need to match to anything because the only data returned
>  is the value of the cookie I want.
>

It needs to match _everything_.

So use:

RE: .+
TP: $0$

or

RE: (.+)
TP: $1$

>
>
>  --
>  View this message in context: http://www.nabble.com/Cookie-not-recognized-tp18142357p18161045.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
>
>

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


Re: Cookie not recognized

Posted by timvanderet <ti...@comcast.net>.
ok so a couple of questions about regex extractor. Should it be a child of
the HTTP Request which is posting the login info or should it just come
after it?

I also don't know what to put in the "Regular expression" or "template" 
field. It doesn't need to match to anything because the only data returned
is the value of the cookie I want.


-- 
View this message in context: http://www.nabble.com/Cookie-not-recognized-tp18142357p18161045.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: Cookie not recognized

Posted by sebb <se...@gmail.com>.
On 26/06/2008, timvanderet <ti...@comcast.net> wrote:
>
>  thanks so much for your response. Could you give a little more detail about
>  how I would go about doing this? How to set it up?

Find out what cookie the browser is sending and where it gets its data from.

Use the Regex Extractor to get the data from the response, and save it
in a variable.

Use the Header Manager to add the Cookie header in the appropriate format.

>
> --
>  View this message in context: http://www.nabble.com/Cookie-not-recognized-tp18142357p18144850.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
>
>

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


Re: Cookie not recognized

Posted by timvanderet <ti...@comcast.net>.
thanks so much for your response. Could you give a little more detail about
how I would go about doing this? How to set it up?
-- 
View this message in context: http://www.nabble.com/Cookie-not-recognized-tp18142357p18144850.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: Cookie not recognized

Posted by sebb <se...@gmail.com>.
On 26/06/2008, timvanderet <ti...@yahoo.com> wrote:
>
>  Hi everyone. I new to Jmeter so excuse me if my vocabulary is a bit off. I
>  know there are a lot of posts regarding cookies, but even after extensive
>  searching I couldn't get my question solved.
>
>  I used a HTTP Proxy Server to record my actions in firefox. I logged into a
>  site, created an event on a calendar, and logged out.
>
>  There are 3 different cookies used doing this process (confirmed by firebug)
>  Before login there is a "j session id" and after login there is a second "j
>  session id" and a "j user id" The two j session ids are being recorded and
>  sent properly. However the j user id isn't being recognized as a cookie.
>  according to the listener tree when Jmeter sends the request to login (posts
>  all my login info), the response data is the value of the j session id.
>  However it doesn't get recognized or stored as a cookie.

JMeter only recognises cookies that are sent as Set Cookie headers.

>  Furthermore, in all
>  of the subsequent HTTP requests there is a parameter with name: "context id"
>  and value:"12145XXXX" (the same value returned earlier, which was confirmed
>  to be j user id in firebug)
>
>  When running the test in Jmeter the login repeatedly fails so I'm assuming
>  this cookie issue is the problem. Does anyone have any insight into this?

Perhaps there is some Javascript in the returned page that is creating
a cookie from the returned data.

You could use a Header Manager to create a cookie using data extracted
using the RE PostProcessor.

>  thanks so much
>
> --
>  View this message in context: http://www.nabble.com/Cookie-not-recognized-tp18142357p18142357.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
>
>

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