In this chapter, go through an iOS app test step by step.
Test scenario
Test the pre-instrumented iOS KeyPass mobile app. Your test includes the following steps:
- Start the app on the iOS device.
- Create a new password database.
- Name it
MyPasswords. - Set the password to
1234. - Validate that the category General exists.
- Exit the app.
Before you start
Complete these preparations before recording:
- Device settings: Apply the required device settings to your iOS device and install the Ranorex Service App (RxServiceApp).
- 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 Solution 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 is in the Endpoints pad.
- Ranorex Service App running on the mobile device, showing the KeyPass app as instrumented.
Create the test
- Click RECORD.
-
In the device/app selection dialog, select:
- Your iOS device
- The KeyPass app
- Click Create.
What Ranorex Studio sets up for you
After you click Create, Ranorex Studio prepares the mobile test environment.
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 iOS device
The instrumented KeyPass app launches on the device.
Ranorex Spy
Ranorex Spy opens in live tracking mode, showing the UI elements of the instrumented 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
For mobile tests, you’ll repeatedly use this workflow:
- Capture a UI element in Spy and add it to the repository
- Create an action in the action table using that repository item (Touch / Set value / Validation)
Create new password database
- Ensure that the + button is visible on the mobile device.
- In Spy, click Refresh.
- Drag the UI element for Empty folder from Spy to the repository in Ranorex Studio.
- Drag the new repository item into the action table and create a Touch action.
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 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.
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 the created database
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 your repository.
- 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 the steps, your recording should now contain the full flow.
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.