< Previous | Next >

Lesson 2.3: Recording a test

Typically, you record an area or a feature of an app for a test. You will have multiple tests for each area or feature so that you cover the entire functionality of an app.
Mobile tests are typically created by recording a session on the mobile device or on the emulator that runs the app being tested. At the end of the recording session, you close the app and the IBM® Rational® Test Workbench Mobile Client uploads the recorded session to the IBM Rational Test Workbench, where it is used to generate a test.

When you record an app, the Android application (the .apk file) is recompiled into a recording-ready app that has been instrumented to capture user actions. Because Android does not allow two versions of an application to be installed at the same time, the test workbench uninstalls the original application and replaces it with the recording-ready app. When you play back a test, the test workbench uninstalls the recording-ready app and replaces it with a playback-ready app, a version of the original application that has been signed with a test workbench certificate. During this process, you must click the Uninstall, OK, and Install buttons as appropriate.

If your device or emulator is on Android 4.1 or earlier, and you enabled the silent mode option, the uninstallation and installation process happens in the background. To enable silent mode, connect the device to a computer that has the Android SDK installed. Use an USB cable and enable USB debugging. Ensure that you installed the appropriate USB driver. Next, open the command prompt on the computer, point to the C:\Users\Administrator\Downloads\android-sdk-windows\platform-tools directory, and run the following commands:
  • adb devices: Lists the devices connected to the computer by the USB cable.
  • adb tcpip 5555: Makes the silent mode option available on the device.
Follow these steps every time you reboot the device.

Silent mode is not available on devices and emulators with API level 17 and later (Android 4.2 +) due to a known limitation.

  1. In the mobile test client, click Manage Applications. The calculator app is displayed.
  2. Click the calculator app and then click the Record button. You are prompted to uninstall the app. Click OK. Then click Install and then click Done. The app starts.
  3. In the app, click 8 + 4 =.
  4. Click the Back button to exit from the app. Notice the incoming recording in test workbench.
  5. In the Test Navigator view, expand Mobile and Web UI Incoming Recordings, right-click the app and click Generate Test.
  6. In the Select Location dialog box, type the file name as Calculator and click Finish. The test is generated out of the recording.
  7. Click Open Test to open the test. The test will look like this.
    Test editor
  8. To ensure that the recording was successful, run the test from the mobile test client.
    1. In the mobile test client, click Manage Applications > Calculator.
    2. Click the Calculator test, and click the Run Test icon Run Test.
    3. You are prompted to uninstall and install the playback-ready app. Follow the instructions in the wizard. After this process, the test will play back on the device. Do not interact with the mobile device until the test is complete. The test result is displayed.
The Test Navigator view shows the recording session file, test results, and the test file in the respective folders.
Test Navigator view

Lesson checkpoint

You created a recording in the mobile test client and generated a test in the test workbench.
< Previous | Next >

Feedback