Load testing, implemented properly and performed throughout the development cycle, can significantly reduce the number of failures experienced by an application. Performance related issues in production affect the revenue the application generates and it is also very expensive to fix! Performance testing is not just done to measure overall the response time of the application and but also to understand the behavior of the system with other applications in the system!
There are many types / strategy of load testing, each of which simulate different load on the application. Each strategy helps us to identify different types of problems in the application / infrastructure.
Aim of this article is to explain how to run different performance tests to identify potential issues by using property files.
In order to execute multiple strategy using a single JMeter test plan, We need to follow certain best practices while designing JMeter test scripts. I would suggest you to read these articles in the given order first before continuing this article.
If you had read the above articles, then this article is basically going to be very simple for you!
Sample Test Plan:
Lets consider the below test plan for better understanding!
The above test plan has multiple thread groups. It uses a Property File Reader to read the environment configuration details and another instance of Property File Reader to read the thread group configuration. Now, We are going to modify this test plan slightly to execute different test strategy easily.
# default.properties # default think time in milliseconds timer.wait=10000 # Anonymous User - Product Search group1.usercount=0 group1.rampup=0 group1.duration=0 # New User Registration group2.usercount=0 group2.rampup=0 group2.duration=0 # User Login & Order Creation group3.usercount=0 group3.rampup=0 group3.duration=0 # User Login & Existing Product View group4.usercount=0 group4.rampup=0 group4.duration=0 # BackOffice Admin User Activities - Existing Order Edit/Cancel group5.usercount=0 group5.rampup=0 group5.duration=0
# system-warmup.properties # default think time in milliseconds timer.wait=0 # Anonymous User - Product Search group1.usercount=1 group1.rampup=1 group1.duration=300 # New User Registration group2.usercount=1 group2.rampup=1 group2.duration=300 # User Login & Order Creation group3.usercount=1 group3.rampup=1 group3.duration=300 # User Login & Existing Product View group4.usercount=1 group4.rampup=1 group4.duration=300 # BackOffice Admin User Activities - Existing Order Edit/Cancel group5.usercount=1 group5.rampup=1 group5.duration=300
# soak-test-strategy.properties # Anonymous User - Product Search group1.usercount=300 group1.rampup=300 group1.duration=28800 # New User Registration group2.usercount=100 group2.rampup=100 group2.duration=300 # User Login & Order Creation group3.usercount=100 group3.rampup=100 group3.duration=300 # User Login & Existing Product View group4.usercount=200 group4.rampup=200 group4.duration=28800 # BackOffice Admin User Activities - Existing Order Edit/Cancel group5.usercount=20 group5.rampup=20 group5.duration=28800
# new-user-registration-stress.properties # New User Registration group2.usercount=400 group2.rampup=100 group2.duration=1800
By properly designing a Performance test plan in JMeter with ‘Property File Reader’ element, we execute a specific test strategy at run time. Each strategy reveals different kind of performance issues. By creating Jenkins pipeline, we also execute different strategy on a daily basis as part of daily build to find the performance issues as early as possible in the SDLC.
Happy Testing & Subscribe 🙂