Performance testing with JMeter at Specialisterren
At Specialisterren test automation is mainly carried out in the functional area. Applications are automatically functionally tested using various tools. Besides functional testing of applications, it is also important to test the performance and stability under load. This requires a different approach than functional testing and therefore also different tooling. The aim of testing under load is to send a representative number of requests to the server, in order to simulate the behaviour of a few to many simultaneous users. This allows you to measure how this affects the server’s response times. To do this, we use Apache JMeter. Read more about our approach in this knowledge blog
Approach to a performance test
Setting up a load or performance test consists of a number of steps: The first step is to identify the scenarios that will be run during the performance test. Such a scenario consists of a number of steps from the application, which result in requests to the server. After the scenarios have been determined, the number of users who are running that scenario at the same time is examined, the so-called concurrent usage
Realisation with the help of Apache JMeter
Apache JMeter is an open source tool used in many places to perform load and performance tests. JMeter provides the functionality we need to set up, run and report on load and performance tests. However, JMeter is not a browser, which means that all Javascript activities, as commonly used in today’s advanced web clients, are not executed. JMeter sends requests to the server and receives replies, nothing more, nothing less. These messages are of course the same as a browser would do. The requests to the server often contain information received in a reply to a previous request. JMeter allows the tester to filter information from responses and include it in subsequent requests. This defines a scenario as a series of matching requests. In addition, within JMeter, data sets can be used in files, which are used during testing to add variation to the scenarios. After all, not every customer buys the same thing from a web shop.
Simulate competitor use with Apache JMeter
One of the most important things in performance testing is to simulate concurrent usage, similar to or even higher than the expected peak load. For each scenario, a group can be created within JMeter where the number of concurrent users (called threads) are configured. As shown in the figure below, the “users” can be started up in groups to prevent a tsunami of requests being sent to the server right at the start. In this example, there will be 12 concurrent users running, started in 4 increments of 3 users. In case the JMeter process becomes the limiting factor, you can also test in the so-called distributed mode. Multiple processes are then running and bombarding the application with requests.
JMeter version
JMeter has several ways to carry out a test. Firstly, there is the GUI mode where the tester can see what is happening and follow the tests in real time. This mode is suitable for setting up test scenarios and tests with low load (few concurrent users). In addition to the GUI mode, there is the CLI (Command LIne) mode. In this mode, there is no graphical interface to maintain and heavier tests can be run. This mode is also suitable for integration into CI/CD pipelines and build servers like Jenkins.
Finally
JMeter is a great tool that we have been able to use successfully in various projects. Of course, a tool alone is not enough, or to quote Grady Booch “A fool with a tool is still a fool“. Building the tests is the precise work, and still human work.
For more information on Apache JMeter, please visit their website.
This knowledge blog was written by our Integration & tooling specialist Robert Schrijvers.