This is a migrated thread and some comments may be shown as answers.

LoadTesting - Handling Cookie Expiration

1 Answer 86 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 17 Sep 2019, 08:38 PM

Hello,

I am working through creating load tests.  For one of my applications, I recorded through fiddler and loaded into test studio. 

The response sets a cookie, which was recorded, to expire after 1 hour.

When I go to run the test anytime after an hour I get unauthorized because the cookie expired.

Does anyone have a recommended approach on this?  Maybe how to clear cookies before a load test execution?

1 Answer, 1 is accepted

Sort by
0
Accepted
Elena
Telerik team
answered on 20 Sep 2019, 12:50 PM

Hi David,

There are some specifics about load testing in Test Studio, which will help you sort out the encountered difficulty, and I will be happy to assist with these. 

You mentioned you have captured the generated traffic using Fiddler and then imported this into a load test user profile. Basically recording the traffic through Test Studio will do the same, so there is no difference in how you created the user profiles

Next thing to do, in order to get a valid load scenario, will be to modify the captured or imported traffic - you will need to go through the HTTP requests and remove these, which are calling any resources like pics, icons, css styles, fonts, etc. These got recorded because of the browser UI session, but are not necessary for the actual load test run. You can add think times, insert some custom cookies or replace any URLs - similar to using BaseURL. 

So, once you have left only the needed requests in the profile, you can proceed with the dynamic targets - these are unique parameters or variables used by the application to generate information like a unique user ID or session ID. These values are generated by the web server and sent to the browser, which then later returns that value back to the server, so that the application can match the new request to a previous HTTP transaction. To accurately simulate users via virtual users, it is important to correctly return these Dynamic Targets during the load test execution.

To get to your particular query - you will need to adjust the cookies and their expiration date within custom dynamic targets. What you need to do is to go through the http requests and check which of these contains the new cookies in its response - that cookie will also have expiration date set somehow. So, you can use that HTTP request step as a source and pass the cookie and the expiration date as a variable for all requests, which then use it. 

This approach allows you to parameterize the requests in way to be valid by each next execution without further adjustments. Once you prepare the user profile as per the above notes, you can proceed with the test settings and running the test.

I hope this will be helpful for you to adjust the cookies in your load scenario. However, if you have any questions, please let me know.

Regards,
Elena
Progress Telerik

 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
Tags
General Discussions
Asked by
David
Top achievements
Rank 1
Answers by
Elena
Telerik team
Share this question
or