What is Performance testing?
It is a type of software testing technique to determine the speed, stability and scalability of a system, application or program. It is a quantitative approach to test how the system will behave under a high concurrent load.
Speed – It checks whether the response of the application is fast.
Stability – It verifies if the application is stable under varying loads.
Scalability – it determines the maximum user load.
Why Performance testing?
The objective of performance testing is to recognize risks and loopholes in applications to ensure a better user experience and retention rate. However, it is not feasible for users to organically connect and test the application effectively.
Now let’s move ahead and find out some excellent tools for performance testing.
Performance testing tools:
JMeter is an open source tool that serves as an effective software to measure performance stats such as elapsed time, latency and throughput. This tool offers a better user experience and a friendly User Interface (UI). Moreover, we can easily install it to evaluate Web applications’ performance.
LoadRunner is a low-cost tool that reduces the risk of deploying systems which do not meet the performance requirements. It provides effective tool utilization.
Stress Stimulus is used for big applications. It is an easy to handle tool as the test wizard covers all steps from recording to test results. This tool exports script code to a Visual Studio format to aid with scenarios that fail when recorded in Visual Studio directly.
Load Ninja creates script-less load tests and playback with the expeditious recorder. It allows for load test execution with different browsers and it is hosted on the cloud hence no server machine is required.
There are multiple tools available for performance testing, but for the purpose of this blog, our focus is on JMeter. In this blog, we will go through the steps that address the most common challenges faced by QA teams during Performance testing.
How does JMeter work?
Let’s have a look at how the JMeter tool works:
Connection with the Browser:
Install and open the Firefox browser, open “Settings” and then click on “Network Settings”.
Check the radio button “Manual Proxy Configurations” and put the IP address of your PC in HTTP Proxy field.
Use 7070 in the Port field and press “OK”.
Now, the browser settings will be ready to connect. Download the apache JMeter.
Open the JMeter, click on “Bin” and then click on “JMeter Windows batch file”.
It will open within the CMD window and the JMeter window will open in same instance as shown below:
Elements of JMeter:
A Thread Group is collection of threads and each thread represents a virtual user using application. The Thread Group element helps create a performance test scenario in JMeter. We can create a Thread Group by following the steps given below:
The Thread group contains the following fields:
- Number of Threads: It represents the total number of virtual users performing the test script execution.
- Ramp-Up Period:It describes the total time (in seconds) it will take for the execution of number of threads (Virtual Users).
- Loop Count: Loop Count refers to the number of executions for the script. For example, if the loop count is 2 and number of threads is 10, then the script will run 20 times. If the loop count is set for “forever” then the new threads will keep on running until the tests are stopped.
Http(s) Test Script Recorder screen will open. Set port to “7070”, set target controller on “Test Plan > Http(s) Test Script Recorder” and select “Put Each Group in a New Controller” option.
Click on the “Request Filtering” and then click on “Add suggested Excludes”.
Listeners are used to monitor the results of a test execution, it can be in the form of a table, graph or a log file.
The Graph Result Listener shows the server response time on a graph and Result Tree Listener displays results in basic HTML format. Additionally, the Table Result Listener shows the summary in a table format and Log Listener displays summary in the text file.
We can generate the script by adding a domain for which you want to do the performance test. Press the “Start” button.
JMeter will start the execution after clicking on the start button. The user needs to open Firefox and execute the steps on the given domain. JMeter will record each step and finalize the steps when the user will click on the “Stop” button. One of the recorded executions is shown below:
Create JMX file
While working on a project in JMeter, there are many options that you can use to save the project in JMX file. You can simply click on the “Save” button highlighted in the screenshot.
A pop-up will appear in which you can type in the name with the file type “JMeter [.jmx]” and then save it.
Run existing JMX file
In the JMeter app, click on “File” and press “Open”. All the saved JMX files will appear, select project and press “Save”. When the project opens, click “Run” and the system will run the JMX file.
Execute existing Test Plan
To execute a test plan, click on open and select the existing JMX file, the system will open the script in JMeter. We can add “View Results Tree” as shown in the screenshot given below. Once JMeter is executed, it will show the succeeded and failed steps as shown in the screenshots below. It will define the executed Test steps results, which are completely dependent on the Thread Group. The fields highlighted in red represent the failed steps and green ones show the successfully proceeded steps.
At the footer of the image below, the following statistics are represented in colors:
Black: The total number of current samples sent
Blue: The current average of all samples sent
Red: The current standard deviation
Green: Overall rate that represents the number of requests per minute handled by the server
The statistics discussed above depend upon various factors like
- Server’s current load
- Internet speed
- CPU performance and specification of running system
- OS: MAC or Windows etc.
Note: It is improbable to get the same results as shown in above graph, however they can be a bit similar.
The above-mentioned steps will help you achieve your performance testing goals and assist you in using JMeter with ease, allowing you to perform thorough testing for all your applications. You can gain a deeper understanding of JMeter by reading “Part 2 “of this blog.
If you have any question or queries, do not hesitate to reach out to us!