Android app test example | Ranorex
Help CenterUser GuideWeb and mobile testing

Android app testing 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

    Create a Dropbox account

     

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

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

    Ranorex Spy

    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.

    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

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

    Open the menu

    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.

    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.

    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.

    Enter folder name and create 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.

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

    Add the folder image to your repository with Spy.

    Create the following action with this repository item.

    Validation action that uses image-based validation.

    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.

    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.

    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