August 20, 2017

Using Randomness To Improve The Quality Of Load Tests

Load tests should closely match real-world behavior so as to provide a developer with realistic results. This means that your tests should consider the fact each user will spend an unpredictable amount of time on a web page and enter different data into the system. The best way to capture this unpredictability of real life situations is to add randomness to the load tests. There are two main areas where randomness will help in creating accurate load tests: client sleep time and data stores.

Client sleep time is used to account for the instances when a user is not doing anything on the system. A user could be reading studying a diagram or reading text on a web page. Inexperienced load testers will overlook this issue, but it is important that you include it in your load tests. Each user will spend a different amount of time on the site therefore a developer should randomize sleep time for each virtual user and test. Most tools and programming languages used for load testing provide libraries that generate random numbers. Some tools even allow you to set the sleep time for a specific virtual user. Incorporating random sleep times to your load tests allow you to get realistic performance data from your load tests.

Data stores are files that contain parameterized data. If a developer is testing a login system, they would need to create data that contains unique login IDs and passwords for each user. One can use tools such as Mockaroo that generate high quality dummy data. If you not have the funds to pay for Mockaroo, you can use in built tools from Ruby and R that allow you to create large amounts of dummy data. When creating dummy data be sure to include incorrect data that will test the validation features of your system. Once you have created your dummy data, your user scenarios will incorporate the data in the actual load tests.

The above are just some of the ways of using randomness to improve the quality of load tests. There are other ways of using randomness such as simulating random network traffic and so on. Various tools and cloud providers will have their own method of incorporating randomness in load tests.