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.
- A client is required to connect with the web application generate a script based on the requests that the web application receives.
- An HTTP Module is responsible for recording the requests and sending the information for a request back to a client.
- A test agent is required to execute test scripts once they have been generated.
The solution contains 5 projects:
This is the HTTP Module that transfers request information.
This is a WinForms application that connects to the BUG and generates the test script.
This is used for executing test scripts execution.
This is a library of helper classes and methods.
This project exists to contain any test scripts that have been generated.
How to create a new test
- Recompile the WTC.sln
- Copy the BUG\bin\debug contents to the bin directory of the web application that is to be scripted.
- Modify the web application’s web.config file to include the httpmodule section as per BUG\README.txt
- 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.
- Click Start
- When the Stop button has become enabled, scripting may begin for that web application.
- Launch a new instance of Internet Explorer and type in a valid URL for the web application.
- 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.
- 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.
- After the SPY has been stopped, click “Build”. The interface will change to display a C# script for executing the test.
- Cut and paste the code into the MI6Camp project. This is the assembly used for all test scripts.
How to execute a test
- Launch the Agent application.
- Click Edit->Add Test (or press the Insert button on the keyboard)
- A list of available tests will appear.
- Select the test(s) that are to be executed and click Accept.
- The test(s) selected will now appear in the main UI.
- Click on the item in the list to view or set its properties
- After setting the properties, add more tests or prepare for a test run.
- 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).
- Click Execute->Run (or press F5) to perform a test run.
- Enter the name of the log file and click Start.
- The test will run in the background appending to the log file until it completed or the Stop button is clicked.
- 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.
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).