Create a Mobile App Test Case using Traffic Recording
3 minute read
This guide shows how to record a user journey on a mobile app and convert it to a test case for StormForge Performance Testing. As an example we will perform a user journey with Mozilla’s app for the Pocket service and record the network requests using the proxy iOS app Charles (also available for other platforms).
To follow this guide, you need a StormForge account (sign up here), a mobile app you want to test and a proxy tool like Charles.
As always, if you have any questions, feel free to get in contact any time!
Observing requests made by an website or web application is relatively easy, because modern Browsers offer great build in development tools. For mobile apps, especially native apps, it is significantly more difficult to directly observe the behaviour of the app in terms of HTTP requests performed to its back end.
Creating meaningful and realistic test case can be a challenge in these cases. One solution is to create a test case based on the actual requests that an application performs. To do this, you can record traffic from a user journey on a mobile app and convert that recording into a test case definition.
That means you execute some user interactions on a mobile app running on a actual device, record the HTTP requests that are executed and export a HAR file. Finally you convert the HAR file into a test case definition with our HAR converter.
Prepare Charles Proxy
To record the user journey on a mobile device a network proxy is needed. As already mentioned, we will use Charles Proxy on iOS for this purpose. Our example app will be Pocket. You can use any mobile app or website you like though.
First, we need to setup Charles and adjust some settings to prepare our recording session. These steps are only required once.
- Open Charles Proxy, open Settings, select “SSL Proxying” and enable it
Next we need to tell that Charles should intercept all HTTPS traffic. In the SSL Proxying screen, select “Include” and add a default include.
- Go back to the main screen and set Status to “Active”
Charles works as a local VPN app, so you will need to allow it. After you enable Charles, you will be asked to allow the VPN configuration.
- Install Charles SSL Certificate
In order to allow Charles to read encrypted TLS traffic, you need to install Charles “SSL Certificate”. Go back to “SSL Proxying” settings and look for the “certificate” section.
Select “Install SSL Certificate” and follow the instructions on that screen. If you have followed the step, Charles should tell you that the “Certificate Status” is trusted.
Record User Journey
Now you are ready to record your first user journey. You can repeat the follow steps multiple times if you want to test different scenarios.
- Open the application or website you want to record a session of
- Execute the steps for the user journey you want to record
- Go back to the Charles app and tap on “Current Session” cell to view the recording
- Tap on the Host of the back end you want to create a test for
- Use the iOS share sheet to export the recorded requests
Convert Recording to Test Case
You can use Charles to open the exported sessions and convert them to HAR (using the export feature). Our HAR converter helps you to create a test based on your previously recorded session and ensures you get started quickly:
- Go to https://app.stormforge.io/perftest/har
- Drop the HAR file of the recording and create a new test case
- Name the test case and save it
Run first Test
You can know examine your generated test and - if you are ready - run your first test!