Record Android client application test scripts in IBM Rational Performance Tester

With the growth of smart phone use, more web-based applications are offering access from a mobile client, whether it is a browser or a native application. In both cases, these clients are likely to use HTTP as the networking protocol, which, in theory, makes them testable using the main load-testing tools. But most of the products currently available don't have built-in functionality to record a test for a mobile client application. Valerio Pengue explains how to use the Android emulator to set up a simple framework to record an HTTP test for an Android application in IBM Rational Performance Tester. This article is for intermediate to advanced Rational Performance Tester users.

Valerio Pengue (pengueva@ie.ibm.com), Software Performance Engineer, IBM

Author1 photoValerio Pengue has six years of experience as a software performance engineer. He has spent the last 3.5 years working on social software reliability testing in the IBM Software Lab in Dublin, Ireland.



22 August 2012

Also available in Chinese Russian Vietnamese Portuguese

Context for this article

With the growth of smart phone use, more and more web-based applications are starting to offer access from a mobile client, whether it is a browser or a native application. In both cases, these clients are likely to use HTTP as the networking protocol. In theory, that makes them testable using the main load-testing tools. On the other hand, most of the products currently available, including IBM Rational Performance Tester, do not have built-in functions to record a test for a mobile client application.

This article explains how you can set up a simple framework to record an HTTP test for an Android application in Rational Performance Tester by using an Android emulator.


Set up the Android emulator

The Developers section of Android.com provides detailed installation steps for installing the software development kit, or SDK. See the Resources section of this article for a link.

Install the necessary components

You will need to install at least the following components:

  • Android SDK
  • Desired Android platforms (at least one is required)
  • SDK platform-tools (install the latest version)

You might want to download and install the Eclipse plug-in, although it's just for development purposes. Also, make sure that you have an updated version of the Java Development Kit (JDK) on your workstation. The Java Runtime Environment (JRE) alone is not sufficient.

Create a virtual device

After you have installed those components, you need to create a virtual device. You can use the wizard in the Android Virtual Device Manager (AVD Manager) to do this by following these steps:

  1. In the Android SDK, open a terminal, navigate to the Tools directory, and then execute: android
  2. From the Virtual devices tab, select New.
Figure 1. Create a new virtual device
Android virtual device manager view, New selected

Fill in the following details for the AVD:

  1. Name: Name of the virtual device
    • Target: The desired Android platform
    • SD Card: You can leave Size empty if you don't need an SD card for your tests. Otherwise, specify the required size.
    • Hardware: It is best to allocate at least 1 GB of memory to the virtual device. Add a new Property (Device RAM Size), and set the value to 1024.
Figure 2. AVD details
Settings in the AVD details Edit view

Install a native application

The following steps are required if you need to record the Rational Performance Tester test from a native Android application (you can skip them if you will use only the Android browser):

  1. Start the virtual device before installing the native application. You can start it directly from the AVD Manager (Start) or run the following command line under the Tools folder (substitute your information for words in italics):
    emulator -avd virtual_device_name
  2. Install the native application by running the following command line under the Platform-tools folder:
    adb install your native application name.apk
  3. If you need to use files for your tests (for example, if you want to upload files to your target application from your mobile device), you will need to push them into the virtual device. Run the following command line from the Platform-tools folder with the virtual device running:
    push your file name /sdcard/file name on the device

Alternatively, you can push files into the virtual device by using the Eclipse plug-in.


Record the test in Rational Performance Tester

After your application has been installed on the mobile virtual device, you need to change the proxy settings in the emulator so that the HTTP requests sent by the application will be served through the embedded Rational Performance Tester HTTP recording proxy.

Change the proxy settings for recording

To change the proxy settings, in your mobile virtual device, select Settings > Wireless & Networks > More > Mobile Networks > Access Point Names > TelKila (internet), and edit the following attributes:

  • Proxy: IP address of your machine. Use the absolute IP address. Don't use 127.0.0.1, localhost, or the hostname, because the connection to the Rational Performance Tester proxy doesn't seem to be work with these values.
  • Port: For the Rational Performance Tester proxy port, the default is 1080.
  • Username: Leave this empty (not set).
  • Password: Leave this empty (not set).
  • Server: This should be the same as the proxy.

Leave the default values for all of the other attributes.

Figure 3. Proxy settings in the mobile virtual device
Virtual device proxy settings screen capture

Click to see larger image

Figure 3. Proxy settings in the mobile virtual device

Virtual device proxy settings screen capture

Record and generate the script

After you have configured the mobile device, you can start the recording in Rational Performance Tester.

  1. Start the recorder and, under Test Nature, select HTTP Test.
Figure 4. Start the Rational Performance Tester recorder
Recording wizard
  1. Select Unmanaged Application as the client application.
Figure 5. Select the client application
Select client application window
  1. Define the proxy recorder settings. Leave the default proxy port unless you need to specify a different value.
  2. Click Finish.
Figure 6. Proxy recorder settings
Use the standard proxy recorder settings
  1. When the recorder has started, you can start your mobile application and record the Rational Performance Tester script.

If you have performed all of the steps correctly, you will see the KBytes counter number increasing in the Recorder Control tab as you run the HTTP requests from your mobile client (see Figure 7).

Tip:
It is a good practice to add comments for each interaction with the mobile application during the recording so you can identify the transactions afterward.

Figure 7. Recorder Control tab with the KBytes counter
KBytes counter and initialization completed notice
  1. After you have manually completed all of the transactions that you want to record from your mobile client, you can stop the recorder by clicking on the Stop button in the Recorder Control tab.

The test will generate automatically and you can customize and replay it.

Resources

Learn

Get products and technologies

Discuss

Comments

developerWorks: Sign in

Required fields are indicated with an asterisk (*).


Need an IBM ID?
Forgot your IBM ID?


Forgot your password?
Change your password

By clicking Submit, you agree to the developerWorks terms of use.

 


The first time you sign into developerWorks, a profile is created for you. Select information in your profile (name, country/region, and company) is displayed to the public and will accompany any content you post. You may update your IBM account at any time.

All information submitted is secure.

Choose your display name



The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerWorks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

Required fields are indicated with an asterisk (*).

(Must be between 3 – 31 characters.)

By clicking Submit, you agree to the developerWorks terms of use.

 


All information submitted is secure.

Dig deeper into Rational software on developerWorks


static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Rational, Mobile development
ArticleID=830060
ArticleTitle=Record Android client application test scripts in IBM Rational Performance Tester
publish-date=08222012