In this chapter, we’ll go through an Android app test step by step.
In this chapter
We’ll test the freely available Dropbox mobile app. Our test contains the following steps:
Connect mobile device
Instrument the app
Create a Dropbox account
⇢ 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
Your device in the Endpoints pad.
Ranorex Service App running on the mobile device, showing the Dropbox app as instrumented.
The dialog for selecting the mobile device and instrumented app appears.
Select your Android device and app (the Dropbox app) and click Create.
Ranorex Studio now executes the following processes to set up mobile test building.
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.
The instrumented app starts on the mobile device. In our case, this is the Dropbox mobile app.
Ranorex Spy starts in live tracking mode for all UI elements of the instrumented mobile app.
Element browser in Spy showing all the UI elements of the instrumented app.
Live view of the instrumented app on the mobile device.
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.
Step 1: Identify validation text
Ensure that the validation text Empty folder 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 validation
Drag the new repository item to last position in the action table.
In the context menu that opens, click Validation.
Define the Validation action: For Match-Name, select Text and for Match-Value, enter “Empty folder”.
Step 1: Identify UI element
Ensure that the button for opening the menu is visible on the mobile device.
Click Refresh in Spy.
Drag the UI element for the button 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.
The option to create a new folder is located in the breadcrumb menu of the Dropbox app.
Add the UI element for the menu option New folder to your repository with Spy.
Create a Touch action with this repository item.
Touch action linked to the repository item for the menu option New folder.
Add the UI elements for the Folder name text field and the Create button to your repository with Spy.
Create the following three actions with these repository items:
Touch action to place the cursor in the text field.
Set value action to enter the folder name.
Touch action tapping Create to create the folder.
Now we’ll validate that the folder exists. We’ll use image-based validation for this purpose.
Add the folder image to your repository with Spy.
Create the following action with this repository item.
Validation action that uses image-based validation.
Image-based validation is explained in Ranorex Studio fundamentals > Validation > ⇢ Image-based validation
Deleting the folder requires that we open a menu, tap the first Delete button, and then tap the second Delete button.
Add the three required UI elements to your repository with Spy.
Create the following actions with this repository item.
Opens the folder menu by tapping the respective symbol.
Taps the first Delete button.
Taps the second Delete button.
The repository items that we need already exist. Use them to create the following two actions.
Validates that the Dropbox home screen is empty (a simple copy of action #2).
Closes the app.
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, whether for 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