Load Testing with Azure
Handling Get and Post Requests
Azure Load Testing is a fully managed Azure service that enables developers and testers to generate high-scale load with custom Apache JMeter scripts and gain actionable insights to catch and fix performance bottlenecks at scale.
A pretty good documentation is available online at: https://docs.microsoft.com/en-us/azure/load-testing/overview-what-is-azure-load-testing to help someone for creating a resource and tests.
I recently happen to work on a POC for the same and would like to share some of my learnings from this exercise:
1. If one would like to write a JMeter script in Azure that would run a 1000 or more URLs (Get Requests) in one go, below is a script for that:
· This script contains a “CSV Data Set Config” node to read paths from a csv file (TestWebsiteUrls.csv) and set the values in the “Path” variable used inside an Http Sampler node.
· This CSV file could contain as many as paths one would want.
· This script simulates a load test of five virtual users simultaneously accessing a web point as the value specified in the ‘stringprop name”1567”’ is 5.
· “LoopController.Continue.forever” is specified as false. This property tells Azure service to terminate the test plan after all the threads have completed their first run. If we want to repeatedly run our Test Plan, we must set this value to “True”.
· HttpSamplerNode: It is a highly customizable node when determining which request you want to send to a host.
2. If it is required to perform a load test on the URL’s requiring a form submission, for example: Login form. The script below would be useful:
Notes: Explanation for the new nodes added in this script are:
1. This script has a few additional nodes in comparison to the first script like the Regular Expression Extractor, it is a post-processor that can be used to apply regex on response data. The matched expression derived on applying the regex can then be used in a different sampler dynamically in the test plan execution.
2. Http Cookie Manager: The cookie manager stores and sends cookies just like a web browser. If you have an HTTP Request and the response contains a cookie, the Cookie Manager automatically stores that cookie and will use it for all future requests to that website.
3. Arguments: Argument nodes are added to provide the required payload to the “Post” request. It consists of key-value pairs.
After the test plans are executed on Azure, we get a set of artifacts to download and review. The artifacts consist of reports, statistics, custom graphs, response times, and throughput values.