Testing your ASP.NET application

Microsoft's Application Center Test (ACT) is a tool that allows you to test your Web applications. Find out how to establish a test environment and create a test with the ACT product.

User experience is imperative to a Web site's success, so ensuring the proper functionality of each feature is important. Once you remove all bugs, you must test the application in a production quality environment. That is, an environment that simulates the load you expect once a developer moves the application into production.

There are many tools available for such testing, including Microsoft's Application Center Test (ACT). It's available as a stand-alone product, and Visual Studio .NET Enterprise Edition includes a version of ACT. Let's take a closer look at using this tool to assess a Web application.

Get your ACT together

ACT stress tests Web servers, allowing you to analyze performance and scalability problems with Web applications. The inclusion of ACT with Visual Studio .NET Enterprise Edition doesn't limit it to testing ASP.NET-based applications. For instance, you may also use it to test any type of Web application including Active Server Pages (ASP), Java Server Pages (JSP), and HTML.

ACT tests the Web application by simulating a large group of users and opening multiple connections to the Web server. The connected clients send HTTP requests to the server. ACT allows you to specify the number of users/connections to simulate.

In addition to the standard HTTP protocol, ACT supports various authentication schemes that you may utilize within a Web application; this includes the popular Secure Sockets Layer (SSL) protocol.

Note: ACT installs as a setup option when installing Visual Studio .NET Enterprise Edition. Before we begin creating tests, you should properly configure the test environment to ensure reliable test results.

Testing environment

Microsoft provides the following guidelines for establishing a test environment for use within the ACT product:

  • The test environment should contain only development or test Web servers.
  • Developers should minimize all network activity that doesn't relate to the test. Also, avoid running multiple tests simultaneously in the same test environment.
  • For a stress test, create enough Web server load to bring the processor utilization to at least 80 percent.
  • Use fast network components and avoid using HTTP proxy servers. Stress testing relies on increasing load levels until the Web server or application becomes the bottleneck and prevents further increases. If any part of the system is slower than the Web server or Web applications, it's impossible to measure the maximum capacity of the server or applications. Increasing the test load levels will not solve this problem.

With the product properly installed and your test environment set up, we're ready to begin creating and running tests.

Creating a test

Once you install ACT, you can utilize it as a stand-alone tool or via Visual Studio .NET. With the stand-alone option, ACT is available via the Visual Studio .NET Enterprise Features subfolder of the Visual Studio .NET location. Also, a new project type of ACT Projects is available in Visual Studio .NET. Both options provide the same functionality, but staying in the familiar Visual Studio .NET workspace is a nice option. I'll focus on using the Visual Studio .NET interface.

The main component is the ACT project. You create a new ACT project in Visual Studio .NET by creating a new project using the ACT Project option. The ACT project file is an XML file with the .act file extension. With the project in place, you may add tests to it. Also, on project setup, Option is the specification of a proxy server and port (if used). This is what you enter in the project's Properties window.

You may add a test to the project by right-clicking on the project and selecting Add New Item. The ACT installation includes two test scripts (one in JScript and another in VBScript), and one option for recording a browser session. This last option is the most straightforward method to be testing your application as soon as possible.

Once you select the Browser Recorded Test, a window opens with the Start and Cancel buttons. The Start button begins the recording process by opening a new instance of Internet Explorer. All activity within that instance of Internet Explorer is recorded. When it finishes, you may return to the Browser Record window and select Stop. This allows you to select OK to save the test in your project or Cancel the process. Selecting Save generates a VBScript file containing the script for the recorded test. You can learn a lot about ACT scripting by examining the script generated by the system.

Once the session stops recording, you may use it to test your application. That is, you may use the session as the basis for testing application performance. Test properties allow you to control the number of connections, tests, and so forth. Here's an outline of the various available test properties:

  • Iterations: The number of times the test should run.
  • RunTime: The amount of times the test should run.
  • WarmupTime: The amount of times the test should wait before starting.
  • Connections: The number of connections for the test to simulate.

The test actually executes via the Test drop-down menu, which is available when inside an ACT project. The menu allows you to start and/or stop the test, as well as view the test results. The test results appear in the output tab of the Visual Studio .NET workspace.

The Browser Record test is just one of the many testing possibilities available with ACT. The other basic tests that come with the ACT installation only send an HTTP request to a specified address, but ACT includes an extensive object model that you may utilize to build full-featured tests using either VBScript or JScript.

TechRepublic's free .NET newsletter, delivered each Wednesday, contains useful tips and coding examples on topics such as Web services, ASP.NET, ADO.NET, and Visual Studio .NET. Automatically sign up today!

About Tony Patton

Tony Patton has worn many hats over his 15+ years in the IT industry while witnessing many technologies come and go. He currently focuses on .NET and Web Development while trying to grasp the many facets of supporting such technologies in a productio...

Editor's Picks

Free Newsletters, In your Inbox