Mobile App Recording with SilkPerformer and the Windows Phone Emulator

Mobile App Recording with SilkPerformer and the Windows Phone Emulator

When developing applications for the Microsoft Windows Phone platform, it’s common practice to utilize Web Services. Many mobile applications, for example stock tickers and weather apps, retrieve data from Web Services so that they can provide accurate and current data to the user. Usually the impact on the Web Services caused by these mobile applications is difficult to estimate. The question of how scalable or redundant a Web Service must be is one of the biggest challenges faced by mobile application developers.
 
This article demonstrates how Silk Performer supports the process of developing and testing these types of applications by recording and customizing data exchanged between the mobile application running inside the Windows Phone Emulator and a Web Service.
 
Using this approach, developers can load and performance test their Web Services in advance to gain a better understanding of scalability and redundancy requirements.

Getting Started

A simple Windows Phone Silverlight project will serve as our example for recording and customizing the traffic generated by the Windows Phone emulator.

Make sure you have Microsoft Visual Studio and the Windows Phone Developer Tools installed before getting started with the example.

These tools can be downloaded from http://msdn.microsoft.com. This site is a great resource for finding answers to questions you may have about Windows Phone development.

The Application

The sample application used throughout this article is a basic Windows Phone Silverlight application that retrieves data from a WCF Web Service hosted on a Borland Web server.

After building and launching the sample project in Microsoft Visual Studio, the Windows Phone emulator launches and runs the sample application. Its user interface is simplistic, consisting of only a button and a text field that displays the data retrieved by the Web Service when the button is pushed.

Recording

To record network traffic generated by the Windows Phone emulator, a new application profile must be created in Silk Performer:

  1. Launch Silk Performer
  2. Select Settings | System… to open the System Settings dialog.
  3. On the Recorder | Application Profiles tab, click the Add… button.
  4. Create a new application profile called WP7 Emulator and specify the path to the Windows Phone emulator executable (for example, C:\Program Files\Microsoft XDE\1.0\XDE.exe). Also ensure that the Web checkbox in the Protocol selection area is checked. 

Now create a new Silk Performer project using Web Browser | Silverlight as the application type. The Silverlight project type automatically takes care of encoding and decoding binary data sent to and received from WCF Web Services. This will allow for easy customization of the data later.

  

Once the project has been created, click Model Script on the Silk Performer workflow bar. From the Workflow – Model Script dialog, choose the previously generated application profile WP7 Emulator.

 

IMPORTANT: Before starting the recording session, close the Windows Phone emulator.

As soon as the Silk Performer Recorder is running, launch the Windows Phone emulator from Visual Studio. If the recording log contains the following lines, the emulator’s network traffic has been hooked successfully:

...
Spy DLL initialized ...
Start recording WinSock traffic of application: C:\Program Files (x86)\Microsoft XDE\1.0\XDE.exe
...

Push the button on the Windows Phone application to call the WCF Web Service and generate network traffic. The Silk Performer Recorder will report and log any newly recorded functions.

Close the Silk Performer Recorder and save the recorded script, which should contain following lines:

    WebUrlPostBin("http://demo.borland.com/WeatherApp/Service1.svc",
      "<s:Envelope xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:a=\"http://www.w3.org/2005/08/addressing\">\r\n"
      "  <s:Header>\r\n"
      "    <a:Action s:mustUnderstand=\"1\">urn:Service1/GetTemperatureCelsius</a:Action>\r\n"
      "    <a:MessageID>urn:uuid:b42a8165-9743-47b6-8093-a1ef5ee1e892</a:MessageID>\r\n"
      "    <a:ReplyTo>\r\n"
      "      <a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address>\r\n"
      "    </a:ReplyTo>\r\n"
      "    <a:To s:mustUnderstand=\"1\">http://demo.borland.com/WeatherApp/Service1.svc</a:To>\r\n"
      "  </s:Header>\r\n"
      "  <s:Body>\r\n"
      "    <GetTemperatureCelsius>\r\n"
      "      <location xmlns:b=\"http://schemas.datacontract.org/2004/07/WeatherService.Web\" xmlns:i=\http://www.w3.org/2001/
      "XMLSchema-instance\">\r\n"
      "        <b:City>Linz</b:City>\r\n"
      "        <b:Latitude>223</b:Latitude>\r\n"
      "        <b:Longitude>24</b:Longitude>\r\n"
      "      </location>\r\n"
      "    </GetTemperatureCelsius>\r\n"
      "  </s:Body>\r\n"
      "</s:Envelope>", STRING_COMPLETE, "application/soap+msbin1");

This script can now be replayed by clicking Try Script on the SilkPerformer workflow bar.

Customization

Select Results | Explore TrueLog to open Silk Performer TrueLog Explorer.

 

With TrueLog Explorer, verification statements can be added to the recorded script and data sent to the WCF Web Service can be customized.

Load Testing

After customizing the script, Silk Performer can be used to simulate the expected workloads for the Web Service. With this approach you can verify in advance whether or not the Web Service meets the requirements and service levels required by the mobile application.

DISCLAIMER:

Some content on Community Tips & Information pages is not officially supported by Micro Focus. Please refer to our Terms of Use for more detail.
Top Contributors
Version history
Revision #:
1 of 1
Last update:
‎2012-06-15 14:38
Updated by:
 
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.