Load testing an ASP.NET web app under different loads can be done using the Application Center Test (ACT) which is included in both the Enterprise Architect and Enterprise Developer editions of Visual Studio. ACT simulates a large number of users by opening multiple connections to the server and then rapidly sending multiple HTTP requests. The simplest way to do this is to first record a test script and subsequently modify the test properties to match the load test that you want to simulate. For example, in the case of a web service, you would record the steps that you would take to manually enter settings on the web service’s test page, and then let the ACT tool automatically replay the test script simulate a large number of users who are simultaneously accessing the service.
To do this, follow the below steps:
- Add an Application Center Test project to the Solution Explorer (ACT projects are under Other Projects in the Project Types listing).
- Click the ACT project in Solution Explorer, and then select File Add New Item from the menu, and select “Browser Recorded Test (.vbs)” from the template listing.
- Start Browser Record mode and then when the browser opens, navigate to the ASMX page for the web service, select a method to stress test, enter the test values and then invoke the method.
- When the XML is returned from the web service, click Stop in the recorder dialog box.
You will then be presented with the contents of the .vbs script which was generated by the ACT. You can then edit the commands as necessary. The Properties window can be used to set the number of simultaneous browser connections (ie the “stress level”), the iterations and the time in seconds to run the test, the test warm-up time, etc. The test can be started by right-clicking the .vbs file in Solution Explorer and then selecting “Start Test.” which will start the load testing.
A load test can recorded and run within Visual Studio but there are some big advantages to using ACT’s standalone interface instead. The ACT standalone interface is easier to work with and also provides more in-depth reports info and graphs. For example using the ACT interface allows for adding additional performance counters to a report.
ACT tests can be set to run for either a time period or a fixed number of script iterations. When you are setting the number of iterations, be mindful how this relates to the number of simultaneous browser connections. The number of requests issued for the test is a product of the two settings. For example, if you set the number of simultaneous browser connections is set to 20 and the number of iterations is set to 20, the web service which is being tested will actually receive 400 requests before the test is complete.
Continues…