When creating load tests, dynamic targets make it easy to simulate real-life conditions closely. See how you can use Custom Dynamic Targets to maximize your testing effectiveness.
When recording a load test scenario it is a good practice to specify some parameters that are going to be used for future load test runs. Such parameters may include username, password, user ID or session ID, token etc. If you’ve already red my blog post about How to Run Customized Load Tests with Test Studio you should be familiar with the idea of simulating real-life conditions as closely as possible by using different recorded data for each user.
Telerik Test Studio makes this task a piece of cake with the help of the Dynamic Targets. For your convenience, they are automatically detected by Test Studio while recording, so you can get a value from the response body of the previous request and set it as a query parameter in any of the following requests.
Unfortunately, some dynamic values are not automatically detected, which is why we have introduced Custom Dynamic Targets. The idea behind the Custom Dynamic Targets is to provide an option to explicitly define the dynamic data from preceding request and post it to subsequent request.
To illustrate this in practice I have created a sample login page which uses a Request Verification token for logging in. It is issued from the server in the first response as you can see below:
The token is then reused in the Post Data of the POST request in step 14, where we are submitting login data in order to authenticate:
If you execute your load test in this configuration the same Token will be used and the load test will fail, as this will prevent proper logging in.
This is where we use a Custom Dynamic Target, which will get the token issued from the server and will reuse it in step 14.
The response from the server where we need to get the token from looks like this:
And we extract it as demonstrated below:
In the custom dynamic targets it is displayed like so:
With Custom Dynamic Targets you can reuse values from different parts of the source request’s response, not only from the body - from headers and cookies too. Test Studio provides different ways to get a value from the body of the request’s response such as Text, XML, JSON. Different extractors such as “Text Search,” “JSONPath,” “XPath” and “Regex” will help you extract the value from the body in various ways, depending on what you need.
Want to try all these great load testing features out and see how your system performs? Start a free trial today:
Try Test Studio
Ivaylo is a QA Engineer on the Progress Test Studio team, where he helps build a better and more reliable product. Before starting as a QA Engineer, Ivaylo spent three years as a Technical Support Engineer in Test Studio doing his best to guide customers in their automation endeavours. Ivaylo enjoys skiing, cooking and portrait photography.
Subscribe to be the first to get our expert-written articles and tutorials for developers!