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:
- In the Android SDK, open a terminal, navigate to the Tools directory, and then execute: android
- From the Virtual devices tab, select New.
Figure 1. Create a new virtual device
Fill in the following details for the AVD:
- Name: Name of the virtual
- 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
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):
- 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
- Install the native application by running the
following command line under the Platform-tools folder:
adb install your native application name.apk
- 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
Record and generate the script
After you have configured the mobile device, you can start the recording in Rational Performance Tester.
- Start the recorder and, under Test Nature, select HTTP Test.
Figure 4. Start the Rational Performance Tester recorder
- Select Unmanaged Application as the client application.
Figure 5. Select the client application
- Define the proxy recorder settings. Leave the default proxy port unless you need to specify a different value.
- Click Finish.
Figure 6. Proxy recorder settings
- 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).
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
- 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.
- See Installing the SDK and Using the Android Emulator in the Developers section of Android.com for more details.
- Find out more on the Rational Performance Tester product overview page. Then explore the Rational Performance Tester page on IBM developerWorks for links to technical articles and browse the user assistance in the Rational Performance Tester Information Center.
- Visit the Rational software area on developerWorks for technical resources and best practices for Rational Software Delivery Platform products.
- Subscribe to the developerWorks weekly email newsletter, and choose the topics to follow. Stay current with developerWorks technical events and webcasts focused on a variety of IBM products and IT industry topics.
- Improve your skills. Check the Rational training and certification catalog, which includes many types of courses on a wide range of topics. You can take some of them anywhere, any time, and many of the "Getting Started" ones are free.
Get products and technologies
- Download the trial version of IBM Rational Performance Tester.
- Evaluate IBM software in the way that suits you best: Download it for a trial, try it online, use it in a cloud environment, or spend a few hours in the SOA Sandbox learning how to implement service-oriented architecture efficiently.
- Join the Performance Testing forum, where you can share you questions and knowledge about IBM performance testing products.
- Rate or review Rational software. It's quick and easy.
- Share your knowledge and help others who use Rational software by writing a developerWorks article. Find out what makes a good developerWorks article and how to proceed.
- Follow Rational software on Facebook, Twitter (@ibmrational), and YouTube, and add your comments and requests.
- Ask and answer questions and increase your expertise when you get involved in the Rational forums, cafés, and wikis.
- Get connected. Join the Rational community to share your Rational software expertise and get connected with your peers.
Dig deeper into Rational software on developerWorks
Get samples, articles, product docs, and community resources to help build, deploy, and manage your cloud apps.
Experiment with new directions in software development.
Software development in the cloud. Register today to create a project.
Evaluate IBM software and solutions, and transform challenges into opportunities.