Create a mobile test
In this chapter, you’ll learn about the basics of creating a mobile test in Ranorex Studio.
Before creating a mobile test, make sure you’ve completed all the necessary preparations:
Apply the necessary ⇢ device settings to your device and install the Ranorex Service App.
If you want to test a mobile app, ⇢ instrument the app.
If you want to carry out a web test on your device, ⇢ install the preinstrumented Ranorex Web Browser for Android (recommended) and/or iOS (required).
Create a solution for mobile testing
To create a mobile test, you must use the RocketStart Wizard.
On the Ranorex Studio start page, click New solution using wizard… or click File > New > New solution using wizard…
Mobile iOS app test
Mobile Android app test
Mobile iOS web test
Mobile Android web test
The prebuilt web test will look like this:
This is where you build and control your tests.
The test suite contains a test case with the empty recording module Recording1.
The recording module has a different symbol than usual. This indicates that it’s a mobile recording module, suitable only for building mobile tests. Standard recording functionality is disabled for them.
All recording modules you create in this project are mobile recording modules.
Recording module view
In the recording module view of Recording1, you can start creating your mobile test by adding actions.
Empty actions table
This is where your actions appear.
Create a mobile test
Now that we have our solution, we can start creating the actual mobile test. The procedure is different from that for creating desktop or web tests, but it’s not complicated.
The dialog for selecting the mobile device and instrumented app appears.
Depending on your choice, different test types result. In our example:
Mobile Android web tests using the preinstrumented Ranorex Web Browser
Mobile Android app test using the instrumented Dropbox app
Mobile iOS web tests using the preinstrumented Ranorex Web Browser
Mobile iOS app test using the instrumented MiniKeePass app
If your app doesn’t appear for selection, make sure that you’ve instrumented it correctly.
Setup mobile test building
Click Create to start the setup process for mobile test creation.
Ranorex Studio will automatically carry out 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 device starts on the mobile device. In our case, this is the Dropbox mobile app.
Regarding mobile iOS applications, it is necessary that the Ranorex Service Application is running and active on the mobile device. Ensure that it is not running in the background as this may prevent you from using the start/stop functionality for the mobile application.
Ranorex Spy starts in live tracking mode for all UI elements of the instrumented mobile app.
Live view of the instrumented app on the mobile device
Build the test
Building a mobile test consists of two consecutive, iterated steps:
Step 1: Tap, Track, and Add
In this step, you add a UI element as a repository item to Ranorex Studio to make it available for use in actions.
Tap: Make the element visible in the app, e.g. by tapping it.
Track: Update the live tracking in Spy by clicking Browse endpoint or Refresh.
Add: Select the element in the element tree, right-click it, and add it to the repository. Alternatively, drag and drop it in the repository.
Step 2: Drag, Drop, and Define
In the second step, you “process” the UI element, i.e. you use it in an action.
Drag: From the repository, drag the repository item to the desired position in the action table.
Drop: Drop it by releasing the left mouse button. The context menu opens. Select the desired action.
Define: Make any necessary configurations to the action, e.g. setting timeouts, content of key sequences, etc. The finished action is shown in the action table, linked to the repository item representing the respective UI element in the app.
You can shorten the procedure by directly dragging a UI element from Spy to the action table.
Tips for efficient test building
Remote control your app from Spy
You can remote control your app through Spy. This way, you won’t have to carry out all the actions to bring up menus and different screens in the app on the actual mobile device.
In the live view of Spy, right-click a UI element and click Touch/Tap.
The action is executed on your mobile device as if you actually touched the screen.
Enter text in Spy instead
You can also enter text in a similar way.
In Spy, with a UI element selected, click the Advanced tab.
Find the Text attribute, enter your text, and confirm with Enter.
The text appears in the mobile app as if you typed it in using the screen keyboard.