Welcome to the new Ranorex Support Portal

Android app test example

In this chapter, we’ll go through an Android app test step by step.

In this chapter

Test scenario


We’ll test the freely available Dropbox mobile app. Our test contains the following steps:

  1. Start the Dropbox app on the Android device.
  2. Check if the Dropbox is empty.
  3. Create a new folder called MyDocuments.
  4. Create a screenshot of the Dropbox desktop with the folder in it.
  5. Delete the folder.
  6. Check if the Dropbox is empty.
  7. Close the app.

Preparations


Device settings

  • Apply the required ⇢ device settings to your Android device and install the Ranorex Service App.

Connect mobile device

Instrument the app

  • Download the Dropbox APK from the Dropbox website and ⇢ instrument it.

Create a Dropbox account

Create a solution for mobile testing


  1. ⇢ Create a new solution for mobile testing using the RocketStart wizard.

  2. Open the Endpoints pad.

  3. Open the recording module Recording1.rxrec.

Ranorex Studio should now look as follows:

  1. Empty action table in the recording module

  2. Empty repository

  3. Your device in the Endpoints pad.

  4. Ranorex Service App running on the mobile device, showing the Dropbox app as instrumented.

Create the test


  1. Click RECORD.

  2. The dialog for selecting the mobile device and instrumented app appears.

  1. Select your Android device and app (the Dropbox 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.

  1. 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.

  2. 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 Dropbox mobile app.

Ranorex Spy

Ranorex Spy starts in live tracking mode for all UI elements of the instrumented mobile app.

  1. Element browser in Spy showing all the UI elements of the instrumented app.

  2. 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.

Validate that the Dropbox is empty

Step 1: Identify validation text

  1. Ensure that the validation text Empty folder is visible on the mobile device.

  2. Click Refresh in Spy.

  3. Drag the UI element for Empty folder from Spy to the repository in Ranorex Studio.

Step 2: Define validation

  1. Drag the new repository item to last position in the action table.

  2. In the context menu that opens, click Validation.

  3. Define the Validation action: For Match-Name, select Text and for Match-Value, enter “Empty folder”.

Open the menu

Step 1: Identify UI element

  1. Ensure that the button for opening the menu is visible on the mobile device.

  2. Click Refresh in Spy.

  3. Drag the UI element for the button from Spy to the repository in Ranorex Studio.

Step 2: Define action

  1. Drag the new repository item to the last position in the action table.

  2. In the context menu that opens, click Touch.

  3. The Touch action needs no further definition and is complete.

Note Icon

Note

Creating these first two actions illustrates the 2-step procedure, which remains the same for the following actions. Therefore, the following instructions don’t describe the procedure in quite as much detail.

Create a new folder

The option to create a new folder is located in the breadcrumb menu of the Dropbox app.

  1. Add the UI element for the menu option New folder to your repository with Spy.

  2. Create a Touch action with this repository item.

  1. Touch action linked to the repository item for the menu option New folder.

Enter folder name and create folder

  1. Add the UI elements for the Folder name text field and the Create button to your repository with Spy.

  2. Create the following three actions with these repository items:

  1. Touch action to place the cursor in the text field.

  2. Set value action to enter the folder name.

  3. Touch action tapping Create to create the folder.

Note Icon

Hint

If you want to test the functionality of the on-screen keyboard, you can also automate entering the name by a series of touch actions on the keys.

Validate folder

Now we’ll validate that the folder exists. We’ll use image-based validation for this purpose.

  1. Add the folder image to your repository with Spy.

  2. Create the following action with this repository item.

  1. Validation action that uses image-based validation.

Download

Reference


Image-based validation is explained in Ranorex Studio fundamentals > Validation > ⇢ 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.

  1. Add the three required UI elements to your repository with Spy.

  2. Create the following actions with this repository item.

  1. Opens the folder menu by tapping the respective symbol.

  2. Taps the first Delete button.

  3. Taps the second Delete button.

Validate that the folder has been deleted and close app

  1. The repository items that we need already exist. Use them to create the following two actions.

  1. Validates that the Dropbox home screen is empty (a simple copy of action #2).

  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.

Download

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

USERS LOVE US

SUBSCRIBE TO OUR NEWSLETTER

Get the latest test automation information right in your mailbox.

FOLLOW US

© 2024 Ranorex GmbH. All Rights Reserved