While testing software applications, we often want to see, how an application behaves when put under extreme load conditions. The goal is to see the robustness and ability of an application to not crash and recover successfully after heavy load subsides. This type of testing is known as Stress Testing.
Content
What is Stress Testing?
Stress Testing is a type of performance testing. In this type of testing, we measure the robustness and stability of an application by subjecting it to extreme load conditions, beyond the expected real-world operational load.
With Stress testing, we aim to find a breaking point of the application. A load beyond which the application fails to respond or starts behaving abnormally.
Basically, in stress testing, we make use of performance testing tools like – Apache JMeter. These tools help us in simulating a load of real users by scripting the user flow. Using these tools, we can subject applications to load a large number of users that access the different functionalities of the application. So, if the application is bound to serve 100 concurrent users, we put a load of 120 users. Then we analyze the application behavior and try to answer the below questions-
- What is the breaking point of the application?
- What is the error rate?
- Does it crash?
- How long does it take to recover from a crash?
- Are there any memory leaks?
Disadvantages Stress Testing
- Many of the load testing tools are licensed and charge a good amount of money for the license.
- Even in the case of free and open-source tools like JMeter, a load testing environment is required which should be as close to the production environment setup as possible. This again leads to additional resources and costs.
- Stress test script creation requires scripting knowledge of the language supported by the tool.
- Incorrectly configured or scripted load test plan/script can lead to false performance issues which take a considerable amount of time and resources.
The need for Stress Testing
- The primary objective of Stress Testing is to find the robustness of the system under test. That is – how it behaves in extreme load conditions.
- It helps stakeholders in finding the recoverability and error handling of the application after a crash. This is one of the Non-functional requirements (NFR), in which we measure the time the application takes to recover from a failure.
- It helps in finding the security vulnerabilities that might sneak-in during continuous peak load.
- With the help of stress testing, we can find the memory leak issues, in which the memory is not released even after it is no longer required by a program.
- It helps in measuring the data integrity of the application during extreme load i.e. after a failure the data should be in a reliable state.
Real-world Examples
Let’s see some real-world scenarios where we can find the usage of Stress Testing.
- Education Board’s result website
Stress testing of such websites is very much a requirement as on the day of some result, a huge number of users/applicants/students will login to the application to check their results.
This peak load happens in a short duration also, just at the time when the result is out. So, stress testing can help in finding the breakpoint of the application and analyzing the behavior of the application and recoverability in case of a crash. - E-commerce applications
During sales, new product releases, festivals, the e-commerce applications tend to get a large number of users that too in a very short duration. - News website at the time of some major/viral event
Just to give an example, the day when Michael Jackson passed away, most of the news websites not only slowed down but also some of them also crashed. A careful stress-tested application would have been prepared to be more robust and even in case of imminent crash or failure, it should have recovered pretty quickly.
Stress vs Load Testing
Both Stress and Load testing are a subset of Performance testing. Some people use them interchangeably but these are completely different. Let’s see the difference between the two-
# | Stress Testing | Load Testing |
---|---|---|
1. | A type of performance testing performed to find the behavior of the application under extreme load. | A type of performance testing done to find the performance of the application under the expected load. |
2. | Application’s quality attributes determined during stress testing- Breaking point Robustness Recoverability Stability, etc. | Application’s quality attributes determined during load testing- Performance, Response time Throughput Error rate, etc. |
3. | The maximum load applied is beyond the breaking point. | The breaking point of the application is the upper limit of the applied load. |
Some Popular Stress Testing Tools
The tools for carrying out stress testing are not different from Load testing or performance testing for that matter. So, any performance testing tool can help in creating a Stress testing plan. We just have to increase the number of concurrent users or requests to exceed the breaking point. This is mostly done with the trial and error method. Some popular tools for Stress testing are-
- Apache JMeter – One of the most popular performance testing tools. It’s free and open-source but has a slightly steeper learning curve as compared to other paid and free tools.
- LoadRunner – Micro Focus LoadRunner is one of the industry leaders among performance testing tools. It comes with a community version that is free and supports 50 virtual user load tests.
- LoadNinja – It’s a paid tool but unlike other tools which simulate user load by creating HTTP request, it works with real browsers in the cloud during recording. This helps in greatly reducing the scripting time and also makes the process simpler.
- Locust – It’s a free and open-source performance testing tool that requires script creation in Python. It has the support for running a load test on multiple distributed machines.
- NeoLoad – It is again a paid tool but its drag & drop and other features like recording, support of selenium scripts, etc, helps in faster load test script creation.