fbpx
Go back to all articles

10 Steps to Great Mobile App Performance Testing Using JMeter

Jan 9, 2025
14 min read
author sona

Sona Hakobyan

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

Your application’s quality, reliability, and speed must be the best in this highly competitive market. The most reliable way to identify opportunities and potentials of your product is mobile app performance testing. This process often involves system performance analysis to ensure your application meets user demands under various conditions. In this blog post, we will 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.

How JMeter Сan Be Used For Mobile App Performance Testing?

Apache JMeter is a versatile and powerful tool for performance testing, making it an excellent choice for mobile app testing. Originally designed for web applications, JMeter has evolved to support a wide range of applications, including mobile. Its ability to simulate real-world traffic and measure performance under varying loads makes it a go-to solution for ensuring your mobile app can handle user demands effectively.

Here’s how JMeter can help you with mobile app performance testing:

  • 01
    Simulating Realistic Traffic Patterns
    JMeter allows you to create load scripts that mimic real user behavior, such as logging in, browsing, or completing transactions. This ensures your tests closely resemble actual usage, helping you pinpoint bottlenecks.
  • 02
    Comprehensive Test Capabilities

    JMeter supports HTTP/HTTPS protocols commonly used in mobile apps. It can also handle APIs, a crucial component of most mobile applications, ensuring the entire backend system is tested for performance.
  • 03
    Customizable Test Scenarios

    With JMeter, you can design highly detailed test scenarios, specifying the number of concurrent users, iterations, and test duration. This flexibility helps you test your app’s limits in a controlled environment.
  • 04
    Effective Resource Monitoring

    JMeter integrates with monitoring tools to track server health during tests. Metrics such as CPU usage, memory consumption, and response times provide actionable insights for optimization.
  • 05
    Ease of Integration

    JMeter seamlessly integrates with CI/CD pipelines, enabling you to incorporate performance testing into your development process. Regular testing ensures your app maintains top-notch performance through updates.

1. Choose Operations and Create a Load Profile

The first step in approaching mobile app performance testing using JMeter is to understand what type of operations should be performed and with which frequency, that is, to create a 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 important for your business. It is worth considering possible time limits for those interactions, too. If you do not have suitable statistics, e.g., because your app is new, the profile is created based on your market analysis and forecasts.

Discover more about performance testing services and how they work.

2. Prepare a Real Device or Install Emulator

Now, it is time to decide whether 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. 

For a real mobile device, you have to manually configure a connection with a desktop over a local network, 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

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, you must install the Java Development Kit (JDK) on your PC; otherwise, the app won’t start.

When JDK is installed, you should download the archive with the program from one of the mirrors listed on the official Apache website and unpack it on your desktop. Then, you should run the file jmeter.bat in the bin folder. After the start, a graphical user interface will pop 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 performing a specific task for your virtual users. Before starting the test, all Threads (Users) elements must be configured for load delivery. 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 future queries and responses, which is 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 you to automatically group the script on transaction writing. 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: ensure 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 the certificate you need for 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 seven days. If you need to renew it in the future, you can click the Start button again.

Need a Helpful Hand?

Arrange a 1:1 call with a load testing expert.
  • Discuss different options
  • Receive a personalized quote
  • Sign up and get started

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 JMeter installation directory bin folder. The file you are looking for is called ApacheJMeterTemporaryRootCA.crt.

Transferring it from your desktop to a real device is not a big deal, 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 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 look at the emulator.

There are two ways to install the app in MEmu. First, you can click the APK icon on the right side of the toolbar. This 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 cannot do it seamlessly. The reason is that, nowadays, to protect the application from incorrect data, hacking, data theft, etc., developers add many checks into the code and implement SSL certificates. So, you cannot 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.

8. Record the Mobile App Performance Testing Script Using JMeter

Now, you can start recording the script. Click Start in JMeter and run the application in the emulator or smartphone. If everything is set up correctly, the 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 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 the 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. You may want to insert delays between actions to get as close as possible to the real conditions.

Use the Ultimate Thread Group or the Stepping Thread Group to smooth the load. 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.

Run JMeter Tests in the Cloud

Easily scale your JMeter tests with cloud-based execution.
No infrastructure needed.

How to Design Load Test Plans using JMeter

When it comes to ensuring your mobile app performs under pressure, designing a solid load test plan is like laying the foundation for a sturdy house. You can’t skip it if you want lasting results. With JMeter, you have the tools to mimic real-world usage and uncover performance hiccups before they impact your users. 

But where do you begin? 

Let’s walk through the steps to build a test plan that’s as effective as it is insightful.

Identify Test Scenarios

Start by outlining the key scenarios you want to test. Consider actions that users are likely to perform on your app:

  • Logging in and out.
  • Browsing product categories or listings.
  • Adding items to the cart or completing a purchase.
  • Viewing content or consuming services.

By focusing on realistic user activities, you ensure the test plan reflects real-world usage patterns.

Define User Behavior Profiles

Different users interact with your app in varied ways. Create profiles to represent typical user behaviors:

  • Casual users
    Casual users
    Perform light interactions like browsing or viewing products.
  • Engaged users
    Engaged users
    Perform more actions, such as adding items to their cart or downloading files.
  • Heavy users
    Heavy users
    Simulate intensive usage, such as multiple searches or large file uploads.

Defining these profiles helps you test how your app handles diverse user loads.

Configure Thread Groups

Thread Groups in JMeter define the number of virtual users, their behavior, and the load they generate. Here’s how to set them up:

  • Number of threads (users): Specify the number of concurrent users to simulate.
  • Ramp-up period: Define how long JMeter takes to start all users. A gradual ramp-up helps simulate real-world conditions.
  • Loop count: Set how many times each user repeats the defined actions.

This configuration ensures your test mirrors actual traffic patterns.

Add Logic Controllers

Logic Controllers in JMeter allow you to customize the flow of requests:

  • Transaction controller: Group multiple requests to measure them as a single transaction.
  • If controller: Add conditional logic to simulate dynamic user behavior.
  • Loop controller: Repeat specific actions multiple times for certain user profiles.

Use these controllers to create complex and realistic test scenarios.

Incorporate Realistic Data

To simulate real-world usage, use parameterized data:

  • Add CSV Data Set Config to load dynamic inputs like usernames, passwords, or search terms.
  • Use variables to replace static values in requests with dynamic data.

This step makes sure your test doesn’t repeatedly send the same inputs, making it more authentic.

Integrate Assertions

Assertions validate the responses your app returns during testing:

  • Response time assertion: Ensure responses are returned within an acceptable time frame.
  • Size assertion: Verify the size of responses to detect incomplete or incorrect data.
  • Content assertion: Check for specific text or elements in the responses to confirm functionality.

Assertions help you measure whether your app behaves as expected under load.

Monitor Test Results

Finally, add Listeners to track and analyze the test outcomes:

  • View results tree: Inspect individual requests and their responses.
  • Summary report: Get an overview of metrics like throughput, response time, and errors.
  • Aggregate graph: Visualize the overall performance trends.

Choosing the Right Load Testing Infrastructure

When it comes to running JMeter tests for mobile app performance, choosing the right infrastructure is just as important as creating effective test plans. The infrastructure determines how efficiently you can simulate large-scale loads, run distributed tests, and analyze performance metrics. 

Testers typically have three main options for load testing infrastructure:

FeatureLocal ComputersCloud ResourcesPFLB
Setup and ConfigurationManual setup, time-consumingRequires cloud environment setup and expertisePreconfigured, ready to use from day one
ScalabilityLimited by local resources, unsuitable for large-scale loadsGood scalability, depends on configurationHighly scalable, supports massive loads effortlessly
Distributed TestingComplex, requires significant configurationRequires manual setup and expertise for multi-node testingFully supported with distributed testing out of the box
MaintenanceHigh, requires constant monitoring and adjustmentsMedium, ongoing management requiredLow, minimal effort required from testers
Cost ManagementLow initial cost, but resource limitations may incur hidden costsHigh, costs can escalate without proper monitoringTransparent and optimized for cost efficiency
Advanced AnalyticsNot availableDepends on third-party toolsAI-powered, provides actionable insights
Ease of UseLow, requires expertise in setup and managementMedium, depends on familiarity with cloud environmentsHigh, designed for ease and efficiency

1. Local computers

Some teams opt to run JMeter tests on their local machines. While this can work for small-scale tests, it comes with several challenges:

  • Limited resources: Local machines often lack the computational power to handle high traffic volumes.
  • Complex setup: Distributed testing or running multiple instances of JMeter requires manual configuration and maintenance.
  • Scalability issues: Simulating massive loads, like 300 requests per second or more, can overwhelm local systems.

2. Cloud resources

Another option is to set up your own load testing environment in the cloud. While cloud resources can scale better than local machines, this approach also has its downsides:

  • Infrastructure maintenance: You’ll need to configure, manage, and monitor the cloud environment, which can be time-consuming.
  • Distributed load testing complexity: Running distributed tests across multiple nodes still requires significant setup and expertise.
  • Cost management: Without proper monitoring, cloud resource usage can quickly become expensive.

3. PFLB: specialized cloud load testing infrastructure

For teams looking to avoid the headaches of setup and maintenance, PFLB’s load testing infrastructure offers a fully preconfigured solution that’s ready to use from day one.

mobile app performance testing pflb

Here’s why PFLB is the smarter choice:

  • Highly scalable: Simulate massive loads with ease, whether it’s 300 or 300,000 requests per second.
  • Preconfigured environment: Forget about setup—PFLB provides a fully configured, distributed testing environment.
  • AI-powered analytics: Gain actionable insights with AI-driven analytics, helping you optimize your app faster.
  • Grafana integration: Monitor performance metrics in real time using Grafana’s visualization tools.
  • Custom reporting tools: Generate detailed, easy-to-understand reports tailored to your team’s needs.

Check Out PFLB's Load Testing Infrastructure

With PFLB, you get the benefits of cloud testing without the hassle of managing the infrastructure. It’s designed for testers who need reliable, scalable, and efficient solutions for their load testing needs.

Conclusion

By now, you should have a solid understanding of how to configure mobile application traffic reading, record scripts, and run mobile performance testing using Jmeter. Remember, performance testing is an iterative process, so don’t hesitate to run multiple tests based on your objectives. Besides, tools like PFLB’s cloud-based platform can make the process even more seamless and efficient.

If you encounter challenges or need expert guidance, don’t hesitate to reach out—we’re here to help you ensure your mobile app delivers the performance your users expect.

Table of contents

Related insights in blog articles

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

TestCon Europe 2025: Your Gateway to the Future of Software Testing

testcon europe 2024 preview
Jan 6, 2025

TestCon Europe 2024, the premier software testing conference, comes to Vilnius, Lithuania, from Oct 22-25. Join experts and enthusiasts onsite or online to explore the evolving landscape of software testing. Topics include Shift-Left Testing, TestOps, AI-Powered Testing, and more. Don't miss your chance to be part of this enriching experience. Secure your spot today at TestCon's official page and be at the forefront of software testing excellence.

6 min read

Roles and Responsibilities of the Performance Testing Team

roles and responsibilities of the performance testing team preview
Dec 25, 2024

Performance testing is a specialized discipline focused on assessing system performance metrics like speed and scalability. While it shares the goal of ensuring product quality, it should not be equated with the broader scope of quality assurance. In some organizations, the performance test team operates as part of the QA team, while in others, it […]

6 min read

7 Top gRPC Load Testing Tools

top gRPC testing tools for load testing preview
Dec 23, 2024

If you’re working with gRPC, you already know how important it is to test your system’s performance under real-world conditions. Whether you’re managing microservices or building real-time applications, the tools you use for testing can either save you time or create headaches. So, let’s not waste any time and go directly to the best gRPC […]

6 min read

Top 5 JMeter Alternatives

top jmeter alternatives preview
Dec 20, 2024

It’s hard to find someone in the performance testing community who hasn’t heard of Apache JMeter. We love it for being open-source, free, feature-rich, protocol-friendly, and easily extendable. While JMeter remains a favorite, there are other tools that offer unique strengths and advantages. This article presents a comprehensive list of the top 5 JMeter alternatives, […]

  • 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