Click here to Skip to main content
15,881,757 members
Articles / Web Development / ASP.NET
Article

Performance Scripting ASP.NET

Rate me:
Please Sign up or sign in to vote.
1.00/5 (1 vote)
26 Apr 20064 min read 33.9K   153   13   4
An article detailing a custom ASP.NET performance testing application.

Introduction

Earlier this year I needed to assist with performance tuning one of our company’s ASP.NET applications.

I had a play with Microsoft Application Center Test. Although the application was easy to script and use, I didn’t like the scripting language and its extensibility.

What I really wanted was an application that allowed me to integrate some of our existing .NET classes. I decided to implement an application similar to Microsoft ACT within .NET, written in C#.

How it works

There are 3 main components to the application.

  1. A client is required to connect with the web application generate a script based on the requests that the web application receives.
  2. An HTTP Module is responsible for recording the requests and sending the information for a request back to a client.
  3. A test agent is required to execute test scripts once they have been generated.

The solution

The solution contains 5 projects:

BUG
This is the HTTP Module that transfers request information.

SPY
This is a WinForms application that connects to the BUG and generates the test script.

Agent
This is used for executing test scripts execution.

QTools
This is a library of helper classes and methods.

MI6Camp
This project exists to contain any test scripts that have been generated.

How to create a new test

  1. Recompile the WTC.sln
  2. Copy the BUG\bin\debug contents to the bin directory of the web application that is to be scripted.
  3. Modify the web application’s web.config file to include the httpmodule section as per BUG\README.txt
  4. Launch the SPY application
    • The first textbox is the tcp port that the SPY will listen on for connections from the web application that is being trapped (this should not need to be altered)
    • The second textbox must contain a valid aspx page of the web application that is being trapped.
    • Replace URL is the initial portion of the URL that may differ between servers.
    • Class Name is the name of the C# class that will be generated when “Build” is selected.
    • Display Name is the name that will appear in the Agent program.
  5. Click Start
  6. When the Stop button has become enabled, scripting may begin for that web application.
  7. Launch a new instance of Internet Explorer and type in a valid URL for the web application.
  8. For each request that is made, a new item is added in the listbox. A description may be entered to make test results more meaningful when they are executed. The description will not be changed until the enter key has been pressed.
  9. When the script has been generated, click Stop. At this point, the script may be saved using File->Save. An existing script may be opened using File->Open.
  10. After the SPY has been stopped, click “Build”. The interface will change to display a C# script for executing the test.
  11. Cut and paste the code into the MI6Camp project. This is the assembly used for all test scripts.

How to execute a test

  1. Launch the Agent application.
  2. Click Edit->Add Test (or press the Insert button on the keyboard)
  3. A list of available tests will appear.
  4. Select the test(s) that are to be executed and click Accept.
  5. The test(s) selected will now appear in the main UI.
  6. Click on the item in the list to view or set its properties
  7. After setting the properties, add more tests or prepare for a test run.
  8. Before executing a test run, it is recommended that the test settings be saved for future replication of a test. Click File->Save. (A feature also exists for Opening an existing test).
  9. Click Execute->Run (or press F5) to perform a test run.
  10. Enter the name of the log file and click Start.
  11. The test will run in the background appending to the log file until it completed or the Stop button is clicked.
  12. The log file contains the results of the test run.

Note: The on-screen results may be collated to a different format using the “Collate Results” button.

Conclusion

This application is slightly different from many other performance test applications in that it only traps requests that go through the ASP.NET IIS filters.

A couple of us within our company used this application to performance test and consequently tune our application. I hope that others can find it similarly useful.

I have been told that Microsoft Team Suite – Test Edition provides a lot of the same functionality (although I have not yet seen a copy of it so I can not comment).

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
Australia Australia
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
QuestionCode? Pin
Rafael Nicoletti27-Apr-06 6:36
Rafael Nicoletti27-Apr-06 6:36 
AnswerRe: Code? Pin
Simon McEnlly27-Apr-06 17:54
Simon McEnlly27-Apr-06 17:54 
Hi tkrafael_net,

I do intend on embelishing this article and I will explain how I sniff the request. I've actually been sitting on this for the past 2 months and thought it was time to at least make the source code available to people. The problem is that right now I'm just too busy but I should find time to do so within the month.

In the meantime, the source code is attached so you can download and see how this is done.

In particular, you should focus on the SPY and the BUG projects.
GeneralRe: Code? Pin
Ch][mera20-Feb-07 3:15
Ch][mera20-Feb-07 3:15 
GeneralRe: Code? Pin
Ch][mera20-Feb-07 3:15
Ch][mera20-Feb-07 3:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.