Go back to all articles

10 Steps to Great Mobile App Performance Testing Using JMeter

Nov 30, 2022
12 min read

Nowadays, almost every company has its own mobile app which provides millions of customers with products and services for all kinds of requests. Just think of it: every day, developers upload thousands of new applications and mobile games to Google Play and App Store. To engage and retain users, you should not only have brand new ideas, a great code and design, but also be sure of high system performance.

The quality, reliability and speed of your application must be the best in this highly competitive market. The most reliable way to identify opportunities and potentials of your product is performance testing. In this blog post, we will take a step-by-step look at how to write a load script for a mobile application and run a performance test by generating HTTP/HTTPS traffic on the app server using JMeter.

1. Choose Operations and Create a Load Profile

The first step to approach mobile app performance testing is to understand what type of operations should be performed and with which frequency, that is, to create load profile. The choice of procedures and their intensity is made by analyzing the statistics for the most loaded month, selecting the peak day of that month by the number of interactions, and choosing the peak hour of that day. Pick the most intensive operations from the list for this hour. They should constitute more than 80% of the total load.

The profile should also include the most resource-intensive operations and those that are important for your business. It is worth considering possible time limits for those interactions, too. In case you do not have suitable statistics, e.g., because your app is new, the profile is created on the basis of your market analysis and forecasts.

Do You Want to Load Test Your Product?
Drop us a line to find out what our team can do for you.

2. Prepare a Real Device or Install Emulator

Now it is time to decide whether you want to use a real smartphone or a mobile operating system emulator to write a script. The latter is much cheaper, because you do not need to buy a collection of different devices from multiple vendors. On the other hand, if your app is supposed to interact with a microphone or a GPS module, you probably will not be able to test it without appropriate hardware.

In this post, we are using the MEmu Android emulator. We have also tried it with a real mobile device based on Android 10, and there is no difference other than some visuals.

3. Configure the Connection to the Network

For further work, it will be necessary to connect the desktop and a real or virtual device to the same local network. In the case of the Android OS emulator, everything is simple, because it is installed on your PC and, therefore, connected to the same network. In this case we can safely consider this step implemented.

For a real mobile device, you have to configure a connection with a desktop over a local network manually, which is very easy to do. All you need is to connect a mobile device and a PC to one router via Wi-Fi or, in the case of a computer, LAN.

4. Create a Script in JMeter and Configure an HTTP Proxy Server on Your PC

As for the script, you will need to install Apache JMeter. This is a popular tool for load testing, but If you have not worked with this program yet, it is not a problem. First of all, you need to ensure that the Java Development Kit (JDK) is installed on your PC, otherwise the program will not start.

When JDK is installed, it is time to download the archive with the program from one of the mirrors listed on the official Apache website, and then unpack it on your desktop. Then you should run the file called jmeter.bat in the bin folder. After the start, a graphical user interface pops up. You will use it to work on your test plan.

There is the tree of your JMeter script on the left side of the window, whilst information about the selected element is displayed on the right.

There is the tree of your JMeter script on the left side of the window, whilst information about the selected element is displayed on the right.

Now you can start creating your script using JMeter:

1.  Add the main element to your Test Plan. Right-click Test Plan —> Add —> Threads (Users) —> Thread Group. This thread group can consist of one or more scripts, each of which performs a specific task for your virtual users. All elements from Threads (Users) are needed to configure the load delivery before starting the test. Remember that each script needs a separate “spool” of threads, as the intensity of these scripts can be different.

2. Add Listener. Right-click Test Plan —> Add —> Listener —> View Results Tree. This adds an element to view your future queries and responses, which is very useful when debugging the script.

3. Add Recording Controller. Right-click on Thread Group —> Add —> Logic Controller —> Recording Controller to add an element inside your coil that allows to group the script on transaction writing automatically. This is quite convenient for a lot of actions.

4. Add Test Script Recorder. Right-click on Test Plan —> Add —> Non-Test Elements —> HTTP(S) Test Script Recorder to add an element to record the script. Pay attention to the connection port: make sure it matches the port you specify in your mobile device or emulator settings.

Do not forget to choose Test Plan > Thread Group > Recording Controller in the Target Controller field. This option indicates where the script will be recorded to.

Create a script in JMeter 2

Then you should click the Start button, and JMeter will create a certificate which you will need on the next step. Confirm the creation of the Root certificate in the pop-up window, or wait until it disappears, and stop the recording.

The created certificate will be valid for 7 days. If you need to renew it in the future, you can click the Start button again.

5. Copy and Install the Certificate on Your Mobile Device

The next task is copying and installing the Apache JMeter certificate on a smartphone or emulator. You will find the certificate in the bin folder of the JMeter installation directory. The file you are looking for is called ApacheJMeterTemporaryRootCA.crt.

It is not a big deal to transfer it from your desktop to a real device, but copying a file to an emulator may look tricky. Take MEmu as an example. Click the icon of a folder on the right of the toolbar and open the shared folder screen. Each folder has a Windows icon, which opens a folder on your PC, and an Android icon, which opens an appropriate directory on the emulator. You can copy the certificate to any of these four folders on your PC, and then find it on the emulator by clicking on the relevant Android icon.

To install a copied certificate on a mobile device, it is sometimes not enough just to run it via the certificate installer. Even if the system reports that the certificate has been successfully installed, in fact, it is not. Therefore, you need to go to the settings and do the following:

  • 01
    Go to Settings —> Security —> Install from an SD card. The exact path may vary depending on the device and Android OS version.
  • 02
    Find your certificate in the storage.
  • 03
    Specify the name of the certificate.
  • 04
    Tap OK to confirm installation.
  • 05
    The system will ask you to enter a screen lock password, or create it, if you don’t have any. Agree, and enter the password or set up a new one.
Install a certificate on your mobile device

6. Download and Install the App on Your Mobile Device

It’s time to download and install the mobile application you want to test using JMeter. Since everyone knows how to do this on a real device, let’s take a look at the emulator.

For MEmu, there are two ways to install the app. First, you can click on the icon APK on the right side of the toolbar. It opens Windows File Explorer, where you can find and run your application package. Another option is to download it directly from Google Play, which also works in the emulator.

It is worth noting that if you want to download some client-server application and try to write a script, you will not be able to do it seamlessly. The reason is that, nowadays, in order to protect the application from incorrect data, hacking, data theft, etc., developers add many checks into the code and implement SSL certificates. So you will not be able to get a response from the server via proxy. Of course, it is possible to bypass it with the help of special utilities, but if you are a part of the team working on the project, you’d better ask developers to solve this problem.

7. Configure Proxy on Your Mobile Android or iOS Device

The next step is proxy configuration. To analyze scripts, you need to intercept mobile traffic and transfer it over a certain LAN port to Apache JMeter. You have already configured the proxy server on your desktop, and now you will have to do the same on your emulator.

  • 01
    Open the list of wireless networks in the settings and choose the one you are connected to. Left-click and hold it until a new menu unfolds, then select Modify Network. Click the dropdown in advanced settings and switch proxy to manual.
  • 02
    Enter your PC IPv4 as proxy hostname and type in the port number, which must be the same as you have specified in the HTTP(S) Test Script Recorder setting in Apache JMeter setup.
  • 03
    In the IP Settings field, leave the DHCP value. Remember to save changes.
On a smartphone, the roadmap is similar.

On a smartphone, the roadmap is similar.

Entrust Mobile App Performance Testing to Professionals
Book a free online consultation with our experts.

8. Record the Performance Testing Script Using JMeter

Now you can start recording the script. Click Start in JMeter and run the application in the emulator or on your smartphone. If everything is set up in the right way, recording controller will add a transaction in which multiple requests will be grouped. Each next action in the application will add a transaction with its own queries, until you finish the record by clicking the Stop button.

Record mobile app performance testing script

All Test Plan elements can be moved or commented, also you can hide or show the contents of each element, copy and paste, or delete them. It is also possible to copy a script to another scenario by opening two windows of the tool, which is useful when designing a large project. If you want to save a recorded script and continue your work later, click File —> Save Test Plan as.

9. Disable Proxy on Your Mobile Device

When recording is on, the traffic is sent to Apache JMeter, but after the script is recorded, you will not have access to the Internet via Wi-Fi. To restore the connection, disable proxy server on your test smartphone.

If you are recording a lot of scripts using a real device, you can switch from Wi-Fi to cellular data and back. The proxy settings on the wireless network do not reset, so you can quickly start writing another script.

10. Process the Script and Start the Load Testing

This stage is not different from the processing of a regular script. After parameterizing, correlating and adding test data, a debugging test (one iteration with one virtual user) is run to check for errors. You can see the results of the script debugging by selecting the View Results Tree element from the script tree. In order to get as close as possible to the real conditions, you may want to insert delays between actions.

To smooth the load, use Ultimate Thread Group or the Stepping Thread Group. You will find these in Test Plan —> Add —> Threads (Users). If an element you need is missing, you can add it using Options —> Plugins Manager.

It is also necessary to calculate the pacing of each operation, the number of virtual users used, and the number and duration of load stages. An important step is to add monitoring elements through Test Plan —> Add —> Listener, such as Transactions per Second, Active Threads Over Time, Hits per Second, Aggregate Report, etc.

These tools will help you collect data for further analysis. After all these actions you can start the test.

Have a Project in Mind?​
We have been working on performance testing projects since 2008.
Drop us a line to find out what our team can do for you.
Get a quote You’ll hear back from our tech account manager in one day if not sooner


Hopefully, now you know how to configure mobile application traffic reading, record scripts and run load tests using JMeter. Depending on the test objectives, you may need to conduct a series of launches. If you encounter any problems or obstacles on your way, don’t hesitate to contact us! We are engaged in all kinds of mobile app performance, load and stress testing.

Table of contents
Let us know about your needs
We can provide multiple performance testing services and a lot more than that if the situation needs a far more complex approach.
Get a quote You’ll hear back from our tech account manager in one day if not sooner

Related insights in blog articles

Explore what we’ve learned from these experiences
8 min read

Why Load Testing Is Essential for Ecommerce Businesses

why load testing is essential for ecommerce businesses preview
May 17, 2024

The success of 26 million online retailers depends on the page load time. It significantly impacts the profitability of online services and sales, as customers don’t want to wait over three seconds to make a purchase. To ensure the desired speed, load testing is widely applied. Common Ecommerce Problems That Can Be Solved with Load […]

8 min read

Everything You Should Know about Performance Testing of Microservices

everything you should know about testing microservices preview
May 2, 2024

About 85% of enterprise businesses use microservices. In this article, we will cover the primary specifics of microservices, explain why they need performance testing, and highlight how to make this process efficient. Microservices in a Few Words Microservices (or microservices architecture) refers to a methodology for developing and deploying applications. This approach separates an extensive […]

4 min read

PFLB is Now SOC2 Compliant

pflb is now soc2 compliant preview
Apr 24, 2024

The PFLB team is happy to share the good news. We have passed the SOC 2 compliance accreditation. It means we can assure our clients that our cooperation will be entirely secure. What Is SOC? Introduced by the American Institute of CPAs (AICPA), SOC, or Service Organization Control, is a cybersecurity series of reports made […]

11 min read

How Do Businesses Benefit from Frontend Performance Testing?

how do businesses benefit from frontend performance testing preview
Apr 15, 2024

Crucial bottlenecks are usually backend-related. That’s  why backend performance testing is generally regarded as a must. However, only 1% of companies perform frontend performance testing. They don’t consider that to achieve the best business results, one should combine the two types.  Let’s prove it. We will define their differences, emphasize the importance of conducting backend […]

  • Be the first one to know

    We’ll send you a monthly e-mail with all the useful insights that we will have found and analyzed