Unit Test a COM DLL

To test the deployment of ConfigSeat.dll, a simple ASP can be created that creates a class instance of clsChair, prints the value of color to the browser, and changes the value of color in the class instance. The ASP file DescribeChair.asp, as shown in Listing 13-2, can be placed in a web application on the server hosting the ConfigSeat.dll. The ASP file could be placed under the default web site created by IIS when it is installed. If the server has not been configured to run ASP files, it will need to be configured. Refer to Chapter 12 for instructions on enabling IIS 6 to run ASP.

Listing 13-2: ASP DescribeChair.asp used to test the COM component ConfigSeat.DLL

start example
 <%@ Language=VBScript %> <HTML> <HEAD> </HEAD> <BODY> <% dim o      Response.Write("<p>start Test</p>")                 'create the object since this is hard work      set o = Server.CreateObject("ConfigSeat.clsChair")            'demonstrate that values were changing      Response.Write("<p> color=" & o.color & "</p>")      Response.Write("<p>change color to blue</p>")      o.color = "blue"           Response.Write("<p> color=" & o.color & "</p>")      'destroy object so it can be created again      set o = nothing %> </BODY> </HTML>
end example

To demonstrate the ability of Component Services to show the status of a given COM object being consumed, the DescribeChair.asp needed to be run many times. The stress caused to the web server by a human requesting the ASP file cannot provide enough demand on the COM component or the server hosting the component to cause Component Services to register any resource demand. Microsoft offers two tools designed to provide some load-testing capabilities:

  • Microsoft Application Center Test

  • Microsoft Web Application Stress (WAS) test

WAS is freeware, and Microsoft Application Center Test is part of Visual Studio .NET Enterprise Edition.

To create a resource drain on the ASP to see how it will respond, a simple script was created in the Microsoft Application Center Test tool that simulates 100 concurrent users for 5 minutes. This demand was significant enough to observe the Component Services being stressed in the effort of serving out instances of clsChair. To meet the demand, zero to five instances of clsChair were created at any given time to support a demand of 175 page requests per second. Figure 13-17 shows the Component Services management console indicating the status of clsChair during the load test.

click to expand
Figure 13-17: clsChair use shown in the Component Services management console




IIS 6(c) The Complete Reference
IIS 6: The Complete Reference
ISBN: 0072224959
EAN: 2147483647
Year: 2005
Pages: 193

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net