In this chapter, you’ll learn about the basics of creating a mobile test in Ranorex Studio.
Prerequisites
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.
-
Connect your device to the computer and add it as an endpoint in Ranorex Studio.
-
Finally:
-
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…
-
Click Mobile.
-
Follow the instructions of the wizard.
-
When you get to the screen below, choose which kind of mobile test you want to create and click Continue.
a. Mobile iOS app test
b. Mobile Android app test
c. Mobile iOS web test
d. Mobile Android web test
-
Depending on your choice, the wizard will show you a checklist of necessary preparations. If you followed our instructions under Prerequisites, you should already have completed all of them. Click Continue.
-
Click Finish.
The prebuilt web test will look like this:
-
Test suite view
This is where you build and control your tests. -
The test suite contains a test case with the empty recording module Recording1.
-
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 you have your solution, you can start creating the actual mobile test. The procedure is different from that for creating desktop or web tests, but it’s not complicated.
-
Click RECORD.
-
The dialog for selecting the mobile device and instrumented app appears.
-
Select your device and app. If you select the Ranorex Web Browser, also specify the URL for the mobile web test.
Depending on your choice, different test types result. In our example:
a. Mobile Android web tests using the pre-instrumented Ranorex Web Browser
b. Mobile Android app test using the instrumented Dropbox app
c. Mobile iOS web tests using the pre-instrumented Ranorex Web Browser
d. 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 automatically carries 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.
Ranorex Spy
Ranorex Spy starts in live tracking mode for all UI elements of the instrumented mobile 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 test
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 find step-by-step instructions for creating mobile tests in
- Web and mobile testing -> Mobile testing > ⇢ Android app testing example / ⇢ Android mobile web test example
- Web and mobile testing -> Mobile testing > ⇢ iOS app testing example / ⇢ iOS mobile web test example
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 touched the screen.
Enter text in Spy instead
You can also similarly enter text.
-
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.