Introduction to Performance Testing with Apache Jmeter
What is Performance Testing?
Performance testing is a branch of non-functional testing and a type of Software testing which aims to check non-functional aspects of a software application.
To be more specific, performance testing is the practice to evaluate how a system performs in terms of responsiveness and stability under a particular workload.
Performance tests are executed to examine the speed, robustness, and reliability of software.
We commentate the performance of a software application according to some indicators like;
- Browser, page, network response times
- Server request processing times
- Acceptable concurrent user volume
- Processor and memory consumption
- Number and type of errors that might be encountered with the application
Why do we need to test the performance of our system?
Briefly, we need to make sure that our system will meet the service level in production, to deliver a positive user experience. It is costly to solve performance problems of production, thus continuous performance testing strategy might be helpful as a key to success in the digital business platforms.
Load tests and stress tests are the most commonly executed types of performance testing.
Difference between load test and stress test
This is commonly mixed up part of the performance testing. Since both types are based on a load of huge data, it is very hard to distinguish the difference.
Load testing simulates the number of virtual users that might use an application. In reproducing realistic usage and load conditions, based on response times, this test can help identify potential bottlenecks. It also enables you to understand whether it’s necessary to adjust the size of an application’s architecture.
Stress testing evaluates the behavior of systems facing peak activity. These tests significantly and continuously increase the number of users during the testing period.
In short, load testing is performed to find out the upper limit of the system or application, and stress testing is performed to find out the behavior of the system under pressure.
Performance Testing Tools
Here are a few popular performance testing tools; LoadNinja, Apache Jmeter, LoadRunner, BlazeMeter, and Gatling.
You need to choose which tool to use according to your system needs, testers’ experience, coding abilities, and the cost of the tool. For example, if you need to perform a real browser load you may want to prefer LoadNinja.
If you trust your coding abilities, Gatling is a good option for you. It is a very powerful and accurate load testing tool for web applications and is also good for continuous load testing since designed for DevOps and Continuous Integration.
But, I mostly prefer to use Apache Jmeter for performance testing.
Why do I prefer JMeter?
- It’s free and open-source!
- powerful
- comes with lots of plugins and extendability with a large library
- needs a small amount of a learning curve and a basic knowledge of Network Protocols (TCP/IP ports, HTTP(S) and REST/SOAP, etc.) for initial setup.
- requires less scripting efforts as compared to other tools.
- has a nice record and playback option.
- has simple charts and graphs for analyzing key load-related statistics and resource usage monitors.
- highly portable and supported all Java-based applications.
- can run with UI and Nongui
- can generate nice dashboard reports for executions
- configurable settings(properties)
What can you do with Jmeter?
Apache Jmeter has a nice user-friendly interface to build up your performance test suite. You can find many features to organize your test suite with a tidy and hierarchical structure. Besides the existing features, JMeter has a lot of extension opportunities.
You can add listeners to see the result of your runs and also you can export the results in CSV format. We can use those run results to generate a visualized dashboard report with graphs. It is a good way to see your performance test results and comment due to visual graphs. It is also helpful when you prepare a report of your test run and explain it to managers and market people.
Besides, Jmeter has its own listeners as visualized graphs simpler than the dashboard.
Jmeter is portable and compatible with java based applications. You can prefer to use the JMeter library in your test code if you are using the Java programming language.
You can execute performance tests from Jmeter GUI and also you can choose to run your tests from non-gui mode. I prefer to build the test suite on Jmeter GUI and execute the large load of data via the command line on the console, because you may have problems while running large amounts of data if you are not using a powerful machine. You may reach the full capacity of your device’s CPU limit easily.
Jmeter has preprocessors and postprocessors that give you the chance to prepare powerful test cases and write test scripts with Java language. You can add assertions to your test cases.
You can configure user properties to change Jmeter GUI settings to your personal preference. Also, you can make personal configurations for changing settings and add personalized graphs of the generated dashboard.
To summarize, I preferably use Apache JMeter for performance tests for years and didn’t look for any further tools since I was able to execute a satisfactory performance test, prepare a test report and explain results in a good way. We will be doing hands-on performance testing with the Apache Jmeter within the next few articles. I plan to show you in detail how to prepare a test suite and explain the features of Apache Jmeter. Happy Testing!