Testing MobileFirst applications with IBM MobileFirst Platform Test Workbench
IBM MobileFirst Platform Test Workbench provides several unique resources to test MobileFirst applications.
- You can create functional tests on hybrid and native applications that run on iOS 7.x or Android.
- The test workbench creates tests in a natural language and provides visual test editing.
- The test workbench runs within Eclipse and is integrated with MobileFirst Studio.
The testing approach with the test workbench consists of four stages:
- Recording: You first play your test with the recording-ready app and generate a test script.
- Authoring: You edit and enhance the test script by adding verification points and others instructions.
- Playback: You run the test script on a real device or on a simulator.
- Reporting: You generate an HTML report.
This tutorial covers the following topics:
- Installing and configuring the test workbench
- The mobile client
- Creating a test project
- For more information
Installing and configuring the test workbench
To use the IBM Mobile Test Workbench, you must install an Eclipse plug-in into an existing instance of MobileFirst Studio.
In MobileFirst Studio, go to Help > Eclipse Marketplace and search for "mobilefirst".
When you locate the IBM Mobile Test Workbench, click Install.
Note: New installations of IBM Mobile Test Workbench require the latest version of MobileFirst Studio.
After the Mobile Test Workbench plug-in is installed, you can see that a new Test Workbench perspective is available in Eclipse:
If you do not see the perspective button above, select Window > Open Perspective > Other... and then Test Workbench.
Also, note the following icons in the Eclipse toolbar:
- The leftmost icon opens the Mobile Applications view. This view lists all the applications that are available for testing.
- The next icon opens the Mobile Devices view. This view lists the devices that you use to test your application.
The mobile client
With the mobile client application, you can record tests, run test playbacks, and view reports on the mobile device.
The mobile client application must be installed on a real device or on a simulator/emulator.
The mobile client communicates with the test workbench to install applications, and to store test scripts and test results. Important: Note the Workbench URL in the Mobile Devices view:
Installing the Android mobile client
To install the mobile client on an Android device or on an emulator:
- Use the QR code that is available in the Mobile Devices view to open an installation page on the device.
On the device, the QR code opens a page that displays installation instructions.
- Follow the instructions to download and install the mobile application on your Android device.
- When the IBM Rational Test Workbench application is installed on your device, start the application.
- Configure the address of the test workbench in the Workbench settings section.
The URL is the same as the URL of the page opened by the QR code, without
/mobileat the end. The URL has the following structure:
- Press the device Back button. If the connection is correctly established, you can see the connection icon at the bottom of the screen.
Installing the iOS mobile client
On iOS, the mobile client is a web application that runs in the Safari or Chrome browser on your device.
To run the client, type the Workbench URL in the following format, in a browser on your device:
When using the mobile test client on an iOS device, make sure to enable pop-up windows. Pop-up windows must be allowed for the
Workbench IP address. Safari silently disables pop-up windows and Google Chrome prompts you to allow pop-up windows. To change this setting for Safari, navigate to Settings.app > Safari and disable the option to Block Pop-ups.
Creating a test project
To start testing an IBM MobileFirst application, you must create a test project.
You create a test project in one of two ways:
- After creating the MobileFirst application, and before clicking on Finish, select IBM Mobile Test Workbench:
- You can also select File > New > Test Workbench Project.
Preparing an application for testing
Before you can test an MobileFirst hybrid application, go through the following steps:
- Build and deploy your project by right-clicking the project name and selecting Run As > Run on MobileFirst Development Server, to ensure that the native project is built and the application is deployed to the server.
- If you build for iOS to test on a physical device, make sure that the appropriate certificate is specified in Xcode.
- Right-click the Android, iPhone, or iPad environment in your MobileFirst application and click Run As > Test with IBM Mobile Test Workbench.
You can now see the test-ready application in the Mobile Applications view in the test workbench and in the mobile client.
- Set the state of the application to Available in the Mobile Applications view before you start recording a test.
Creating a test
- Start recording a test.
- On the Android client, select the application in the list of managed apps and click Record in the mobile client on the device.
- On the iOS web client, select the application in the list of managed apps, install the app on the device by clicking Install. When the installation is complete, click Record.
If you are using an iOS 7.1 or later, it is not possible to click the Install button.
Instead, you can install the application from the Mobile Devices view:
Everything that you do with the application is recorded and sent to the test workbench. For example, the script records when you press a button or when you enter text in an entry field.
- To stop recording, close the application by clicking Home (iOS) or Back (Android).
A message that reports the availability of a new recording is displayed on the test workbench.
- Follow the wizard instructions to generate a test from the recording. You are asked to store the test in the test project.
For more information about how to create a test, see the Rational Test Workbench Mobile Test Edition user documentation.
Editing a test
After the recording, you can edit the test in the natural language editor.
You can edit the test to insert verification points (for example, to verify the value of a user interface element), to replace recorded test values with variable test data, or to add dynamic data to the test.
For more information about how to edit the test script, see the Rational Test Workbench Mobile Test Edition user documentation.
Running a test
Run a test to ensure that the app matches the expected behavior as defined in the verification points.
During the test, each verification point is checked and receives a
The available tests are visible in the mobile client and you can run the test from this application.
For more information
For more information about IBM MobileFirst Platform Foundation functional testing and the IBM Mobile Test Workbench, see Testing with IBM MobileFirst Platform Foundation in the user documentation.▲