Friday, September 14, 2007

Maintaining login session with JMeter

I was facing a problem where I was testing my Gridsphere based portal with JMeter, but the only page that was getting recorded was the page immedietely after the login screen. All the other pages (when simulated using JMeter) only showed the login screen when they should have actually shown some content. Basically the problem was that the "login session" was not being maintained across the JMeter thread, and only the first page (because the user entered login/password information) showed up in JMeter's simulation.

The way to maintain "login session" is to add a "HTTP Cookie Manager" to the thread group.
Go: Thread Group->Add->Config Element->HTTP Cookie Manager

And select your browser type.

4 comments:

Vanitha said...

thanks very much for sharing this. answer comes very instant.

Sukhvinder said...

I have a similar situation where in no cookies are dropped by the application. I used the Regular Expression Extractor and stripped off the SessionID and passed the same SessionID in the URL parameter, but again upon sending a different request after login, JMeter was again forwarded to the login page using 302 redirect

Unknown said...
This comment has been removed by the author.
Unknown said...

Thanks for the tip. I would also recommend following recommendations from How to make JMeter behave more like a real browser guide to make your load test as close to reality as possible.