In this article, we present stress testing, its needs and goals, how is it different from load testing, different types of stress testing, its procedure, tools and metrics.
Stress testing is conducted to determine the robustness and scalability of a software product by testing beyond its normal operation limits. It is used for all types of software, but is particularly important for critical software. Stress testing aims at estimating the robustness, availability and error handling capabilities under heavy loads to ensure that the software does not crash under crunch conditions.
Stress testing is a type of software testing to authenticate the stability and reliability of the system under testing. Stress testing even tests beyond the normal operating points and analyses the performance of the system under extreme conditions.
Stress testing is also known as Endurance Testing. In stress testing, the system or the application under testing is stressed for a short period of time to determine its capacity.
Stress testing is prominently used to determine the breaking limit; the limit at which the system breaks or crashes.
Stress testing evaluates the behaviour of a system after it crashes.
Stress testing ensures the system’s recovery after a failure.
Stress testing determines the ability of the system to work under abnormal conditions.
Stress testing ensures that unanticipated failures do not cause any security issue.
Stress testing ensures to display proper error message in case the system is under stress.
Stress testing verifies if the system has saved all the data before it crashes.
Consider this scenario: during a festival or a sale, an e-shopping website may face a spike in traffic. Thus, it is important to conduct stress testing to deal with such abnormal situations, which when not dealt efficiently may cause loss of revenue and reputation. The following are the reasons, stress testing is extremely valuable −
Stress testing helps check the performance of the system under abnormal conditions.
It helps ensure display proper messages when the system fails or crashes.
It avoids enormous revenue and other losses due to failure.
It helps prepare for extreme conditions.
The purpose of stress testing is to analyse the behavior of the system under testing, after it fails or crashes. To ensure the success of stress testing, it should display a proper error message when it is under extreme conditions. In some cases, massive data sets may be used for stress testing, which may get lost anytime. Testers should ensure that no data is lost during stress testing. The main aim of stress testing is to ensure recoverability of a system, that is the system recovers successfully from a failure or crash.
|Load Testing||Stress Testing|
|It is conducted to estimate the performance of the system under normal workload conditions.||It is conducted to test the robustness of the system under extreme load.|
|Load limit is same as the threshold of a break.||Load limit is beyond the threshold of the break.|
|The performance of the system is measured under multiple users.||The performance of the system is measured under varying amounts of data.|
|It involves huge number of users.||It involves both huge number of users and data.|
|It is conducted to determine the upper limit of the system.||It is conducted to determine the behavior of the system under pressure or heavy load.|
|The factor that is tested is performance.||The factors that are tested are robustness and stability.|
|It determines the operating capacity of the system.||It ensures the system is secure.|
|It does not break the system.||It intends to break the system by testing with huge data or resources.|
Server-Client Stress Testing − In this type of testing, the testing is conducted across all clients from the server. It is also known as distributed stress testing. The responsibility of the server is distribution of a group of stress tests to each client and to track their status.
Product Testing − This testing emphasizes on discovering defects, network issues, data blockages and locks, and performance congestion in the system. It is also known as application stress testing.
Transaction Stress Testing − This type of testing is conducted on one or more transactions between two or more systems or applications. It is performed to fine tune and optimize the system.
Systematic Stress Testing − This is an integrated testing conducted to test multiple systems running on a server. It is performed to discover defects where a system data blocks another system.
Analytical Stress Testing − This testing is conducted to determine the performance of the system under abnormal and unexpected conditions. It is conducted to discover defects in unusual conditions, for example a large number of users logging in simultaneously, or database goes offline when accessed from a website. It is also known as exploratory stress testing.
Stress testing follows the following five steps −
Planning − In this preliminary stage, system data is collected, the system is analyzed, and the goals of the stress test are defined.
Creating Automation Scripts − In this stage, automation script of the testing is created, and the test data for the stress scenarios is generated.
Scripting Execution − In this stage, the scripts generated in the previous stage are executed and the stress results are stored.
Analyzing Results − In this stage, the results stored in the previous stage are analyzed to discover bottlenecks.
Optimizing & Tweaking − In this stage, the system under testing is fine-tuned, changes in configurations are made, and the code is optimized to achieve the specified standard or benchmark.
To conduct stress testing of an e-commerce app, a large number of users hitting the app is simulated.
The number of users being simulated for testing would be much higher than average number of users visiting the app daily.
These users are virtual and are programmed to do common activities, such as viewing products, adding and removing items from the cart, purchasing the product, etc.
The number of users is increased to the point, until the app crashes or fails and can no longer handle the traffic.
The results of the tests are examined to discover bottlenecks or drawbacks in the system, performance improvement or optimization areas, recovery mechanism, etc.
LoadRunner − This tool from Hewlett-Packard Enterprise (HP) is widely used for load testing. The results shaped by LoadRunner are used as a benchmark. It works on the concept of recording and replaying users’ activities and then generates the desired load on the server. It simulates the real-world actions and determines the performance of the system or application by generating virtual load.
Jmeter − This is an open-source tool used for stress and performance testing. It is purely written in Java. It covers types of tests like load tests, functional tests, stress tests, etc. Jmeter requires JDK 5 or higher for functioning. It is mainly used to test web and web service applications. It was developed by Apache Software Foundation to test functional behavior and measure performance. It is also used to measure performance of a variety of services. It is originally used for testing web applications and File Transfer Protocol (FTP) applications. Now, it is also used for a functional test, database server test, etc. It is extremely easy and simple to use, one can get quickly acquainted with this tool. Being a pure Java application, Jmeter is platform independent. The test results can be viewed in different formats, such as chart, table, tree, etc. It supports all the basic protocols including HTTP, JDBC, LDAP, SOAP, and JMS.
Stress Tester − This tool helps in the extensive analysis of the performance of web applications. It is easy to use, and the results can be viewed in graphical format. It gives a good return on investment and does not even demand high-level scripting.
Neo Load − This is one of the most popular tools for testing web and mobile applications. It simulates thousands of users to evaluate the performance of the application under load and analyzes the response times. This tool supports cloud integrated performance, load and stress testing. Neo load is simple and easy to use, cost-effective, and offers good scalability. Moreover, it pinpoints the number of simultaneous users that the Internet, intranet or the mobile app can manage. It enables automated test design, thus providing faster test creation. It supports various protocols such as HTTP, HTTPS, SOAP, REST, Flex Push, AJAX Push, etc.
Metrics evaluate the performance of a system and are generally studied at the end of the stress test. Some commonly used metrics in stress testing are −
Pages per second − Number of pages requested per second.
Throughput − Response data size per second.
Rounds − Number of times test conditions were planned to number of times a client executed.
Hit Time − Average time taken to retrieve a page or an image.
Time to the first byte − Time taken to return the first byte of information.
Page time − Time taken to retrieve all the information in a page.
Failed connections − Number of failed connections refused by client.
Failed rounds − Number of rounds failed.
Failed hits − Number of failed attempts taken by the system.
The sole aim of stress testing is to determine system’s performance under extreme conditions or load. It evaluates system resources like memory, processor, network, etc. It also examines the ability of a system to recover from a failure or a crash. It checks if the system displays proper error message upon facing stress.