iOS app testing example
In this chapter, we’ll go through an iOS app test step by step.
Test scenario
We’ll test the preinstrumented iOS KeyPass mobile app that you can download from the Ranorex website. Our test contains the following steps:
- Start the app on the iOS device.
- Create a new password database.
- Name it MyPasswords.
- Give it the password 1234.
- Check if the category General exists.
- Exit the app.
Preparations
Device settings
- Apply the required ⇢ device settings to your iOS device and install the Ranorex Service App.
Connect
- ⇢ Connect your mobile device to your computer, preferably via USB, and ⇢ add it as an endpoint in Ranorex Studio.
Instrument the app
- Download the ⇢
preinstrumented KeyPass app from our mobile download archive and install it on your device.
Create a solution for mobile testing
⇢ Create a new solution for mobile testing using the RocketStart wizard.
Open the E
Open the recording module Recording1.rxrec.
Ranorex Studio should now look as follows:
Empty action table in the recording module
Empty repository
Your device in the Endpoints pad.
Ranorex Service App running on the mobile device, showing the KeyPass app as instrumented.
Create the test
Click RECORD.
The dialog for selecting the mobile device and instrumented app appears.
Select your iOS device and app (KeyPass app) and click Create.
Setup
Ranorex Studio now executes the following processes to set up mobile test building.
In Ranorex Studio
Ranorex Studio starts the selected app on your mobile device and adds the respective action in the action table.
An action that starts the app on the mobile device has been added to the action table.
On the mobile device
The instrumented app starts on the mobile device. In our case, this is the KeyPass mobile app.
Ranorex Spy
Ranorex Spy starts in live tracking mode for all UI elements of the instrumented mobile app.
Live view of the instrumented app on the mobile device.
Build the recording module
Now we can start filling our recording module with actions.
We’ll do this using the two-step test-building procedure for mobile tests as explained in detail in
⇢ Create a mobile test.
Create new password database
Step 1: Identify UI element and add to
Ensure that the + button is visible on the mobile device.
Click Refresh in Spy.
Drag the UI element for Empty folder from Spy to the repository in Ranorex Studio.
Step 2: Define action
Drag the new repository item to
In the context menu that opens, click Touch.
The Touch action needs no further definition and is complete.
Note
Creating this action illustrates the 2-step procedure. It remains the same for the following actions. Therefore, the following instructions don’t describe the procedure in quite as much detail.
Enter the database name
After tapping the + button, a dialog opens asking for a name and a password for the new database. To enter the name, we’ll need to create two actions.
Add the name text field to your repository with Spy.
Create the following two actions with this repository item:
Set value action that enters the name.
Hint
If you want to test the functionality of the on-screen keyboard, you can also implement entering the name by a series of touch actions on the keys.
Enter and confirm the database password
Add the two text fields for the password and its confirmation to your repository with Spy.
Create the following four actions with these repository items:
Touch action and Set value action to place the cursor in the text field and repeat the password.
Confirm database creation
Add the Done button to your repository with Spy.
Create the following action with this repository item:
Touch action that taps the Done button to confirm database creation.
Validate database file
Now we’ll validate whether the database was created correctly.
Add the file name to your repository with Spy.
Create the following action with this repository item:
Delete database and close app
Add the Edit, (-) and Delete buttons to to your repository with Spy.
Create the following actions with these repository items:
Touch action that taps Edit.
Touch action that taps (-).
Touch action that taps Delete to confirm
Closes the app.
Completed recording module
If you followed our instructions, your completed recording should look like this:
You can now switch to the test suite view and run the test. However, in a real-life scenario, the test wouldn’t be quite finished here. The next step would be to modularize the recording and
The concepts of modularizing and structuring apply to all recording modules and test suites regardless of desktop, web, or mobile tests.
Reference
Managing recording modules is explained in:
Ranorex Studio fundamentals > Ranorex Studio Overview > ⇢ Manage recording modules
Structuring a test suite is explained in:
Ranorex Studio fundamentals > Ranorex Studio Overview > ⇢ Test suite structure
A step-by-step example of building a full test suite is available in:
Ranorex Studio fundamentals > Ranorex Studio Overview > ⇢ Build a test