In this chapter, go through an iOS app test step by step.
Test scenario
Test the pre-instrumented 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 mobile device
- Connect your mobile device to your computer, preferably via USB, and add it as an endpoint in Ranorex Studio.
Instrument the app
- Download the pre-instrumented 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 Endpoints pad.
-
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.
-
The RUN button changes to reflect that it now runs the test on the current automation root, i.e. the active endpoint/mobile devices, not the computer.
-
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.
-
Element browser in Spy shows all the UI elements of the instrumented app.
-
Live view of the instrumented app on the mobile device.
Build the recording module
Now, start filling our recording module with actions.
Let's 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 it to the repository
-
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 the last position in the action table.
-
In the context menu that opens, click Touch.
-
The Touch action needs no further definition and is complete.
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:
-
Touch action that places the cursor in the text field.
-
Set value action that enters the name.
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 enter the password.
-
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:
-
Validates that the displayed file name is the same as the one entered during database creation.
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 deletion.
-
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 structure the test suite.
The concepts of modularizing and structuring apply to all recording modules and test suites regardless of desktop, web, or mobile tests.
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