The short story of making it

Posted on April 24th, 2008 by Bogdan Damian

There are a lot of web testing tools out there. A lot of which are free. A friend of mine asked me to help with some automatation tasks and because I didn't like none of what I found, I've decided to make yet another one. My purpose was and still is to create a web load testing tool that will also allow his creator to check if the testing flow is working properly by checking the webpages loaded in an easy way. I splited it in three logical parts:

1. Recording the user navigation.

After searching some time on the web I've selected 2 possible ways to do it: using IE automatization, using Mozilla automatization or a web proxy. Because the mozilla automatization wasn't too suported and there wasn't that much documentation and because the IE automatization is better known and easy to use (you can find a lot of useful articles on this site) I've decided to use IE. For IE you must add mshtml dll to your project(Visual Studio will create the necessary tlbimports). After that, you must code the IE to start and than link the IE with an InternetExplorer class.

The only util event for catching the pages navigation is Navigation event which is called with the params and the URL for the new page. Unfortunately this works perfectly only for normal/nonajax webpages. The ajax calls are not recorded. After further studying the problem I've decided to use a proxy and to record the page navigations through that proxy. In order to do this I started to search the net for a proxy that I could control in a prrogramatic way from .net. I've found the Mentalis Proxy library that is made in c#. This is a verry nice library and I recommend it to anyone who wants to make a proxy or just wants to know how a proxy works. The library allready provided me with what I needed and I just had to add it some events that are allowing me to catch the requests info. So after solving the proxy problem there was only one thing to be done in the recording part. That was to set/unset the proxy automatically for IE. At first it seemd an easy task because I have found a link that explained how to do it. I had to set some registry keys but it's not working in all the cases . At the begining I started the IE programatically there wasn't any need to set the proxy settings for the allready running IE clients. But because IE is not always used for recording user actions and because of the above problems I let the the proxy setting to the user. For keeping the data the application uses for data manipulation some entities that serialize the data in xml format directly(both ways load/unload). The recorded data can be saved/loaded into/from a file in XML format.

2.Playing/running the user navigation .

In order to run the test the program generates a c# class that will do all the work. This is done in a very simple way through XSLT because the data is allready persisted as xml. You can find the xls in the same directory as the executable file, the file name is "RecorderClass.xsl". The good thing about using an xslt file is that if somebody wants to automatically generate a class with some extra features he/she can easily do so by modifying the xsl file. For the person who must do the test the greatest flexibility comes from the fact that by using the C# language and .net framework in general it is verry easy to get some data from a database or a local file. The test class is derived from basetest class which has some util functions. For each procesed request the user can see the params got from the content of the previous request.

3. Viewing the results

For the playing results I made an plugin like functionality in order to in order to allow other viewing functionality. Right now there are only 2 plugins available one for showing the requests that were made and another that is showing the average and instant number of request/sec and the total number of request.

 

Design downloaded from Free Templates - your source for free web templates