In this tutorial, you’ll create a simple Android test in Ranorex Studio using the Dropbox mobile app. You’ll learn the basic workflow for mobile recording, Spy + repository, and validation.
Test scenario
Test the freely available Dropbox mobile app. Our test contains the following steps:
- Start the Dropbox app on the Android device.
- Check if the Dropbox is empty.
- Create a new folder called MyDocuments.
- Create a screenshot of the Dropbox desktop with the folder in it.
- Delete the folder.
- Check if the Dropbox is empty.
- Close the app.
Before you start
- Device settings: Apply the required device settings to your Android 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 Dropbox APK from the Dropbox website and instrument it.
- Create a Dropbox account: You need a free Dropbox account. Create one at www.dropbox.com.
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 Dropbox app as instrumented.
Create the test
- Click RECORD.
- The dialog for selecting the mobile device and instrumented app appears.
- Select your Android device and app (the Dropbox app) and click Create.
Setup
After you click Create, Ranorex Studio sets up the mobile test:
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 Dropbox app launches.
Ranorex Spy
Ranorex Spy opens in live tracking mode for 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 the UI element in Spy and add it to the repository
- Create an action in the action table using the repository item (Touch / Set value / Validation)
You can do this using the two-step test-building procedure for mobile tests, as explained in detail in Create a mobile test.
Validate that the Dropbox is empty
- On the device, make sure the text Empty folder is visible.
- In Spy, click Refresh.
- Drag the UI element Empty folder from Spy to the repository.
- Drag the new repository item to the last position in the action table.
- Right-click the action and select Validation.
-
Configure the validation:
Match-Name:
TextMatch-Value:
Empty folder
Open the menu
- On the device, make sure the menu button is visible.
- In Spy, click Refresh.
- Drag the menu button UI element to the repository.
- Drag the repository item to the action table.
- Right-click the action and select Touch.
The Touch action is complete—no extra configuration needed.
Create a new folder
The option to create a new folder is located in the breadcrumb menu of the Dropbox app.
- Add the UI element for New folder to the repository (via Spy).
- Create a Touch action for New folder.
- Touch action linked to the repository item for the menu option New folder.
Enter folder name and create folder
-
Add the UI elements for:
- Folder name text field
- Create button to your repository (via Spy).
- Create these actions in order:
- Touch the text field (place cursor)
-
Set value to enter
MyDocuments - Touch Create
- 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.
Validate folder
Now, validate that the folder exists. Use image-based validation for this purpose.
- Add the folder image element to the repository (via Spy).
- Create a Validation action using image-based validation.
- Validation action that uses image-based validation.
Delete folder
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.
Validate that the folder has been deleted and close app
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.
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, whether for desktop, web, or mobile tests.