s
User Guide Android Studio

For Eclipse click here

Prerequisites:

Start Robotium Recorder for Android Studio

Start Robotium Recorder from the toolbar: Tools > Robotium Recorder

Record test cases from a module or APK

From Robotium Recorder it's possible to select either a binary (APK file) or a module to record test cases from. In the screenshot below a binary APK has been selected by clicking "select apk" and choosing the APK through the opened file browser. Robotium Recorder automatically signs it with the local debug certificate.

Once the signing process has finished the "Next" button will be enabled. 

Start recording

Clicking Next on the previous screen will show the recording screen. 

In the left bottom corner there is Setting menu with three options in the first tab "Runtime options":

a. Use sleeps - choose if sleeps should be used to playback test cases in the same speed as they were recorded. Can be useful for slower apps like bandwidth intensive or hybrid apps.

b. Keep app data - choose if app data is to be kept when starting a new recording session.

c. Identify class over string - default View identifier is always the resource ID. In the event a resource ID is missing it's possible to choose if a View class identifier is to be used over a String identifier (the text displayed by the View).

d. Click and drag coordinates - choose if click and drag steps with screen coordinates are to be recorded. 

In the second tab "Saved paths" its possible to set the locations of the Android SDK and the Java JDK.

In the third tab "Serial key" its possible to enter the license key and see the status of a current subscription.

Click "New Robotium Test". If an APK is selected, Robotium Recorder will first install the re-signed APK on the device or emulator.

When installation of the module or APK is done the recording will be started.

The app is executed on the device or emulator and recording of user actions starts. 

 

ClickToAssert™ will allow you to verify that a view, label, image or other UI elements are displayed by simply clicking on them.

The recorded steps are shown in the test step table (as seen below).

If a test step is selected in the table the "Delete step" and "Take screenshot" buttons will be enabled.

1. Select any step in the table and click on "Delete step" to delete it.

2. Click "Take screenshot" to add a screenshot step after the selected step.

To save the test case click "Stop Recording" and then "Save", enter a test case name, and click "Ok".

If the test module already exists it will save the test case in that module. Otherwise it will first create the test module and then save the test case. Either run the saved test case by clicking "Run Test", start a new recording or close Robotium Recorder by clicking "Finish".

After Robotium Recorder has been finished click Tools > Android > Sync Project with Gradle Files. This is only needed the first time a new test module is created. 

To see the saved test case(s) expand the test module and look in the src/androidTest sub-folders. A specific test case or the whole test module can be executed by right clicking it and selecting Run 'All Tests'.