- Install Robotium Recorder, if not already installed.
- Connect a physical device (recommended) or start an emulator. Robotium Recorder requires that the device or emulator has external storage. After connecting the device to the computer, make sure to enable USB debugging.
- Make sure the Android API level of the connected device or emulator is available in the Android SDK Manager. Otherwise check the API version and click install.
Start Robotium Recorder for Eclipse
Start Robotium Recorder from the toolbar: Eclipse > New > Other > Android - Robotium Recorder.
Robotium Recorder can also be started by right clicking an existing app or test project and from the opened menu select: Robotium Recorder > New Robotium Test.
Record test cases from a workspace project
From Robotium Recorder it's possible to select either a binary (APK file) or a workspace project to record test cases from. In the screenshot below a workspace project has been selected. Enter a test project name and click "Next".
Record test cases from a binary APK
To record test cases from an APK, click "select apk". A file browser will be opened where the APK can be selected. Robotium Recorder will automatically sign the APK with the local debug certificate.
Once the signing process has finished the "Next" button will be enabled.
Clicking Next on the previous screen will show the recording screen.
In the left bottom corner there is Setting menu with three 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.
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 workspace project 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 stop the recording click "Stop Recording".
To save the test case click "Save", enter a test case name, and click "Ok".
If the test project already exists it will save the test case in that project. Otherwise it will first create the test project 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".
To see the saved test case(s) expand the test project and look in the src folder. The whole test project or a specific test case can be executed by right clicking it and selecting Run As > Android JUnit Test.