JMeter is an Open Source Java application designed to measure performance and load test applications. Apache JMeter can measure performance and load test static and dynamic web applications. It can be used to simulate a heavy load on a server, group of servers, network, or object to test its strength or to analyze overall performance under different load types. Performance testing on your Mobile App is easy to achieve using JMeter which will help to record mobile application traffic. All that is required is just some configuration of the proxy for mobile applications.
You may want to know the difference between testing and debugging and you may want to read more on other configuration settings you can read these: Configuration Manager Tools: How to install and debug logs with the CMTrace Tool, How to install and configure Ansible on Azure Virtual Machine, Keepalive Settings: Understanding keepalive configuration, Installation and configuration of Cockpit on CentOS Linux
Follow the below steps on setting up the JMeter Configuration:
- Launch the JMeter. Give your Test Plan a name.
- Right-click the Test Plan > Add > Threads (Users) > Thread Group.
3. Right click the Thread group > Add > Logic Controller > Recording Controller.
4. Now Right-click the Threads > Add > Listener > View Results Tree. This will help to display the outcome of the test result.
5. Now Add > Non-Test Elements > Add HTTP’s test script recorder.
6. Go to Global settings and set port to 8888 (or any available port). Select the Target Controller from the drop-down
7. Then click on the Start button displayed on HTTP(S) Test Script Recorder, and a dialog box will be opened that will allow for Root CA Certificate. Then click the “OK” button after.
8. How to install the certificate in Firefox. Do the following:
Go to Privacy & Security
Click on Import browse to the JMeter launch directory, and click on the file ApacheJMeterTemporaryRootCA.crt, press Open
Click View and check that the certificate details agree with the ones displayed by the JMeter Test Script Recorder.
- If it is the same then select “Trust this CA to identify web sites“, and Click OK
9. You can install the certificate In Chrome and internet explorer same way by doing these:
- Go to Privacy and Security and Click on Manage certificates.
- Click on Import and browse to the JMeter launch directory, and click on the file ApacheJMeterTemporaryRootCA.crt, and open it
- You can also click on the “Details” tab and confirm that the certificate details agree with the ones displayed by the JMeter Test Script Recorder
10. Now Configure the proxy on your Smartphone
We now need to configure the proxy setting on the mobile device this proxy will be used to intercept all the mobile traffic but the target is the mobile app traffic whenever the Text script recorder is played on the JMeter installed on your Windows system and the result will be transferred back to the JMeter as a report for analysis. Remember we already have our proxy server on our desktop to receive traffic. If you will be using an emulator as your mobile device you will have to configure the same proxy settings on the emulator.
- Go to settings and find the wireless networks you are connected.
- Left-click this network and hold it down and wait for the menu to pop out then select Modify Network.
- Click the dropdown in advanced settings.
- In the Proxy drop-down select Manual.
Confirm your system IP using the ipconfig command in the command prompt.
- Copy it and paste it into Proxy hostname of your emulator.
- Make sure you enter the same Proxy Port with the same one you enter in the HTTP(S) Test Script Recorder settings in Apache JMeter.
Leave the DHCP value as dynamic and click save.
11. After installing the JMeter Certificate on your Windows system then you will need to copy the Apache JMeter certificate to your smartphone or to the emulator you plan to use. The file is called ApacheJMeterTemporaryRootCA.crt. and can be found in the JMeter installation directory bin folder. Follow the steps below in other to properly install the certificate on your mobile device not just running the certificate file.
- Go to your phone or emulator settings > Security > Install from an SD card. Make sure you already copied the file to this location and remember that this setting may be different from one device to another.
Locate the Apache JMeter certificate you copied to the SD card and click on it.
You will need to enter the name of the certificate.
- Click OK to confirm the installation of the certificate.
- Go ahead to set up a screen lock password for security purposes.
After all these configurations you can then run the test and capture the report making sure the Proxy is set to ON.
I hope you found this blog post How to Perform Load Test on Mobile App using Apache JMeter installed on your Windows System Interesting and helpful. In case you have any questions do not hesitate to ask in the comment section.