Testing Silverlight Applications

February 29, 2012 10:28 am 1 comment

If you are going to load test a Silverlight web application with WAPT, first of all you need to install the corresponding extension module that you can download here.

This is a very easy task; you should simply download the file and run it. The module enables support for MSBIN1 format used by Silverlight applications to pass data between the client and server parts. This format is binary. It can represent any complex data structure containing objects of various types, which can, in turn, contain other objects and so on until we come to some elementary objects like text strings or numbers.

The Module for Silverlight Testing converts MSBIN1 messages to XML documents. The benefit is that such documents are easily readable inside WAPT. Moreover, you can extract any data from them and replace constant initially recorded values with session-specific data. In other words, you can parameterize values inside requests containing MSBIN1 content. When WAPT executes tests, it converts XML back to MSBIN1 and the server part of the application receives the data in its native way.

Now I am going to show how this is done on a live example. Unfortunately I do not have my own Silverlight web application, so I have to use a public web site for this purpose. I very much hope that the site owners will excuse me, because I am not going to do anything bad and possibly even make some promotion for them. Here is the web site that I am going to use: www.semyou.com.

If you want to follow my steps, you will need to register a free account on that site and get to the application store. Here we see several applications that are supposed to work “in the cloud”. This means that they provide a web interface and store data on the server. (As we can see, these days the word “cloud” is used to name things existed years before any clouds were invented.) Anyway, we will experiment with the application called “semNote”. It lets you create and edit simple text notes.

A Silverlight application

In our very first test I will simply log in, create a new note with some name and some text in it, and log out. I can do this by clicking the “New” button in the application, entering the text and clicking the “Save” button.

Let’s record such test with WAPT. First of all I should mention one important feature of Silverlight: when it is executed inside an embedded browser object, it blocks keyboard input. This is probably done for some security reasons. Looks strange in any case, but… that’s Microsoft.

What this means for us is that if we want to record a test of a Silverlight application, we should select to use the external browser. So, when I click the “Rec” button in WAPT, I choose that option in the “Recording Properties” dialog box.

Recording with external browser

Now I go to the web site, enter my email and password, run the “semNote” application and create a simple note titled “A note”. I click the “Save” button and close the browser.

Let’s see what we have in WAPT after the recording is finished. The very last request that was recorded after I clicked the “Save” button contains MSBIN1 content converted to XML. We can easily find a node containing the title that I used when created my note. I can edit any nodes here and even insert dynamic values to do any required parameterization. To show this I will add session number to the title. So, the request body will look like this:

MSBIN1 content

To illustrate the result I will run that modified profile with 3 virtual users, so that each user would produce exactly one session. So, my test volume settings are specified as follows.

3 virtual users load

As a result I get the following content inside the “semNote” application.

Result

Each of my virtual users created one note named with the session number. That is what I wanted for now. I am going to show how to make profiles using a more sophisticated parameterization in the future posts.

To be continued…

Leave a Reply