1
votes

I am attempting to Login to my app with JMeter Script.

I have Cookie Manager and a Cache Manager added

My Thread Group script

  • GET on main login page (/app) to return session id and form fields and cookie
  • POST of completed form fields with cookie (/posthandler) with "follow redirects

What happens is

  • POST sends initial cookie (from GET) and form fields and logs in ok
    • the session is established (I see a record in our app database)
    • the response is a redirect with a new cookie
  • JMeter redirects (GET) to the session url (/app?session=xxxxx)
    • this goes with "[no cookies]" (according to request panel)
  • As that request arrives without the new cookies - the app issues a second redirect back to the login page.

So is there a way to force the GET Redirect after the POST response to send the cookie?

My theory is that JMeter is that, because of the different URI path for the POST and redirect GET, JMeter is not sending the cookie.

I have tried

1

1 Answers

1
votes

My problem was self-inflicted !

I was running against a different environment than usual which had a different context root e.g. /test/app rather than /app. For this I amended my ${Domain} User parameter with "my.domain.com/test" rather than adjust all the Path settings.

For requests sent this approach appeared to work as the ${Domain}+${Path} resolved to the correct URL - but the Cookies created by the server were for ${Path} (as in /test/app) and JMeter was seeing this differently (as in /app).

I have now introduced a ${CtxRoot} User variable (set to /test/) and prepended this to all my Path values - and my Login is now working.