December 30, 2024

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.

 

Load Testing On a Deadline

Most developers are familiar with the following scenario. They push hard to deliver on updates and features for an app, website or web service. Before deploying the app to production they realize that they did not load test the app or of it they did the tests do not cover all new features and updates. This article is a guide on how to load test fast, without compromising on the quality of your app.

The first step when load testing on a tight deadline is creating user scenarios. A user scenarios is a collection of web pages and URLs that virtual users will request during load tests. Web developers create different user scenarios based on how they anticipate users will interact with the system. Load Impact, a load testing cloud provider, provides a Chrome browser extension that records a user’s actions to create a user scenario. Each scenario is converted into a script that can be used within Load Impact. Visual Studio also provides a method of creating load test scenarios using its Load Test Editor. Another company that offers a load testing editor is DotcomMonitor.

After creating the user scenarios a developer will create and configure the load tests. One must determine the number of concurrent users to test and the number of user scenarios for each test. If you have historical data, use it to get an average for your performance baseline. You can also test different combinations of user scenarios to simulate the fact that different users will use the system differently. If you’re looking for additional details, you can refer back to DotcomMonitor’s page for more testing information, or also check with the Microsoft Developer Network’s load testing page.

After creating the tests you must now run them. There are four basic steps for load testing: run the tests, analyze system performance, optimize on the bottlenecks and repeat the previous steps. Because you are on a deadline you will not be able to perform many iterations of this process but that is not a problem as you can always run more tests after deploying the website.

Finally you should look into automating your load testing process. Most build systems provide methods for automatically load testing a system. Investing in automation will assist you when there is a deadline in the future. Companies such as Load Impact provide an API that automates a load testing pipeline. You can also automate your load tests using AWS CodeBuild and Jenkins.