Mobile testing with IBM Rational Test Workbench
A step-by-step guide
In this article, you will learn how to perform mobile testing using IBM® Rational® Test Workbench version 8.5 and Android x86 4.0.3 virtual machine.
- IBM Rational Test Workbench version 8.5
- Android 2.2 - 4.2
- For Android
- Android SDK 21 installed
Note: The mobile device must have a working Internet connection. Also, the mobile device must be on the same network as the computer that is running Rational Test Workbench and should be able to ping that computer.
Support for testing native and hybrid applications
You can use Rational Test Workbench to test both native and hybrid applications. A native Android or iOS application is built using a native SDK, whose services are defined according to each platform architecture. Android applications are typically created with Java or C++, whereas iOS applications are created using Objective-C.
Stages in the mobile testing process
To help you to meet your goals, Rational Test Workbench implements the following stages in the testing process:
- Installation and configuration: Set up your test environment with Rational Test Workbench and the SDKs for the mobile operating systems. Install the mobile test client on the mobile device. Ensure that the mobile device has Internet connectivity, and add that device to the test workbench.
- Application preparation: Import the application that you want to test into the test workbench.
- Test recording: Run the application from the mobile test client to start a recording. The recorder application records all user interactions, sensor inputs, and application behavior and then uploads the recorded data to the test workbench, where it can be converted into a mobile test.
- Test editing: After recording is done, you can edit the test in the natural language editor. You can use the mobile data view to display and select UI elements from the recorded applications. You can also replace recorded test values with variable test data or add dynamic data to the test.
- Testing: Deploy and run automated tests on multiple devices to ensure that the application matches the expected behavior defined in verification points. During the run, each verification point is checked and receives a pass, fail, or inconclusive status, and functional data is recorded.
- Evaluation of results: After the test, the device uploads the test data to the test workbench. Functional reports provide a comprehensive view of the behavior of the application under test. Reports can be exported and archived for validation.
Set up the environment for mobile testing
What follows is the detailed description for setting up the environment for performing mobile testing using Rational Test Workbench.
Installing the mobile test client on Android
To perform mobile testing using Rational Test Workbench, first you have to install the mobile client on the mobile device. Below are three ways you can do this:
Installing the mobile test client for an Android mobile device
To record and run tests from your Android mobile device, you must install the Android Rational Test Workbench Mobile Client on the device. Here are the steps to download the installer in order to install the client on the device:
- In Rational Test Workbench, select File > New > Device. A window displays the URL of the workbench and a QR code that contains the URL.
- Depending on the mobile device, perform one of the following steps:
- If the mobile device is equipped with a camera and a QR code-reading application, then run the QR code application and flash the QR code that is displayed on the workbench screen.
- If the mobile device cannot flash a QR code, open the web browser and go to the URL that is displayed on the workbench screen. The mobile device displays a webpage with the download link for the mobile test client.
- In the mobile web browser, tap the link to download the mobile test client installer. After the download completes, tap the complete button.
If the mobile test client does not install automatically, use a file manager application to locate the APK installer file (usually in the Downloads folder) and run the installer manually.
Installing the mobile test client for Android with adb
On some mobile devices, it might not be possible to install the Android IBM Rational Test Workbench Mobile Client by downloading the installer. This topic describes an alternative installation method that uses a USB connection and the adb tool that is provided with the Android SDK.
To install the mobile test client for Android with adb, follow these steps:
- In the test workbench, select File > New > Device. The Add New Device wizard shows the Workbench URL.
- Open a web browser, enter the Workbench URL, and download the mobile test client.
- Copy com.ibm.rational.test.mobile.android.client.ui-release.apk to a temporary folder, for example, C:\tmp.
- Open a command prompt window and point to the Android SDK directory that typically is C:\Users\Administrator\AppData\Local\Android\android-sdk\platform-tools.
- Type the following commands:
- adb connect <IP address of workbench computer>
- adb install <temporary folder>/com.ibm.rational.test.mobile.android.client.ui-release.apk
Installing the mobile test client for Android on an emulator
If the Android device is running on a virtual machine or on the emulator provided by the Android SDK, you can install the Rational Test Workbench Mobile Client either by downloading it or using the adb tool.
Configure the mobile test client for Android
To use an Android mobile device to upload mobile applications and record or run tests, you must configure the Rational Test Workbench Mobile Client to connect to Rational Test Workbench. To add a mobile device to the test workbench follow these steps:
- In the Test Navigator view, right-click the Mobile devices node and select the Available Mobile Devices The Mobile Devices editor opens.
- In the editor, click the icon Add device to listto add a device to the list.
- On the mobile device or on an emulator, start the mobile client.
- Complete one of the following steps:
- If the mobile device is equipped with a camera, tap the QR code button and scan the QR code that is displayed on the test workbench. This step is not applicable to the emulator.
- Tap Set Workbench > Address and type the URL manually.
The name and properties of the device are displayed in the test workbench, in the Mobile Devices editor.
Managing mobile applications
Before you start to record a test from an Android or iOS application, you must use a mobile device to upload the application under test or import the application to the test workbench. With the mobile application editor, you can manage your applications in Rational Test Workbench.
Add a mobile device in Rational Test Workbench by following these steps:
- Launch IBM Rational Test Workbench, and start Android x86 4.0.3 virtual machine.
- Click the Display available mobile devices icon in Rational Test Workbench. The Add New Device wizard displays the workbench URL as shown in Figure1.
Figure 1.Workbench URL
- Open a web browser, type the workbench URL, and click the Proceed with Android instructions link, as shown in Figure2.
Figure 2. Mobile Welcome Page
- Click on the Click here to start download link as shown in Figure3, and download the mobile client for Android OS.
Figure 3.Android Welcome Page
- Now go to the Android x86 4.0.3 virtual machine, and check the IP address as shown in Figure 4.
Figure 4. IP Command
- Run the following command to connect Rational Test Workbench and start Android x86 4.0.3 virtual machine.
- Go to the ../adt-bundle-windows-x86_64\sdk\platform-tools directory.
- Execute the
adb connect <ip address of vm>command as shown in Figure 5.
Figure 5. Connect command
- Install the mobile client (downloaded above) into Android x86 4.0.3 virtual machine using the
adb install –rcommand as shown in Figure 6.
Figure 6. Install command
- Go to the Android x86 4.0.3 virtual machine, and launch RationalTest Workbench Mobile Client.
- Enter the workbench URL in the Configure Workbench field as shown in Figure 7.
Figure 7. The Configure Workbench window
Now, in Rational Test Workbench the Android x86 4.0.3 mobile device is available as shown in Figure 8.
Figure 8. Available mobile devices
To add applications to Rational Test Workbench, follow these steps:
- In the Rational Test Workbench perspective's toolbar, click the Display available mobile applications icon.
- In the Mobile applications editor, click the Add applications to list icon.
- To add an application from your local computer, in from local storage, click the Android app icon. Provide location of the application, then click Next. Select a project, and click Finish.
Figure 9. Mobile applications
- In the mobile test client, go to Managed Apps, then tap the application that you added to the test workbench.
Figure 10. Managed applications
To create mobile tests, record a session on the mobile device that runs the application being tested. At the end of the recording session, close the application, and the Rational Test Workbench Mobile Client uploads the recorded session to Rational Test Workbench, where it is used to generate a test.
To create a mobile test, follow these steps:
- In the mobile test client, tap managed apps, select an application from the list, and then tap record as shown in Figure 11.
Figure 11. Record
2. When the application starts, interact with the device. All your actions on the device and responses from the application are recorded.
3. To end the recording, close the application. The recording is uploaded to the test workbench. Recordings are displayed in the test navigator under Mobile Incoming Recordings.
Figure 12. Mobile test
Editing mobile tests
With the test editor, you can view or customize a mobile test that you recorded. You can use the Mobile Data view to select user interface elements and add some verification points, and to create or modify steps in the test with simplified scripts. Or you can create or modify a set of steps manually directly in the test script.
Figure 13. Adding a verification point
Running mobile tests
You can run a mobile test, either from a device or from the test workbench.
To run a test from the test workbench in the Test Navigator view, open the test and, in the test editor, select the Run button as shown in Figure 17.
Figure 14. Run a mobile test from the test workbench
The test is played back in the mobile device. Do not interact with the mobile device until the test is completed.
To run a test from an Android mobile test client, follow these steps:
- In the mobile test client, tap Managed Apps, and tap the application under Test.
- To view the list of tests available for the application, tap Test.
- Tap the test script, and then tap Run Test.
Figure 15. Run mobile test from Mobile Test Client
The test is played back in the mobile device. Do not interact with the mobile device until the test is completed.
To check whether the mobile test ran successfully open the test report. You can also view each recorded functional action in the report.
Viewing mobile reports:
When you run a test from Rational Test Workbench, you can view both the mobile web report and the statistical report in the test workbench. From the Test Navigator, expand the project folder and double-click the test reports. Follow these steps:
- From the Test Navigator, expand the project folder and double-click the test reports.
- If the Test Navigator is logically arranged, expand the project folder, expand the Results folder, and open reports.
If you have initiated the test run from the device, the mobile reports are stored in the Mobile Results folder.
Figure 16. Mobile report
To view the test reports from a mobile device, follow these steps:
- Open the mobile test client and tap Managed Apps.
- Select the application for which you want to view the results.
- Tap Test, and tap a test for which you want to view the reports. Tap Reports to open a mobile report.
Figure 17. Mobile report from the mobile client
Viewing test logs
To see a record of all the events that occurred during a test run or a schedule run, as well as the status of each verification point, open the test log for that run. In the Test Navigator view, right-click the executed test; then click Display Test Log.
Figure 18. Test log
If you follow the steps specified in this artile, you can automate the creation, execution, and analysis of functional tests for native and hybrid applications on Android and iOS devices using IBM Rational Test Workbench.
- Visit Rational Solution for Test Automation, 8.5 for an introduction to Rational Solution for Test Automation.
- Download trial versions of IBM Rational software.
- Download these IBM product evaluation versions and get your hands on application development tools and middleware products from DB2®, Lotus®, Tivoli®, and WebSphere®.