Lab: Testing and Debugging
In this lab, you ll apply the lessons from this chapter to review a real-world testing plan, write unit tests for a sample application, load test a deployed application, and step through a Web application running on a remote server using the Visual Studio .NET debugging tools.
Estimated lesson time: 30 minutes
Exercise 1: Review a Test Plan
Using an actual test plan, highlight any mention of the following items:
Unit testing
Integration testing
Ad hoc testing
See whether you can find answers to the questions posed in Lesson 1:
How are tests written?
Who is responsible for the testing?
When are the tests performed?
Where are the tests and test results stored?
What is being tested?
Based on this information, does the plan give you a clear idea of how testing will verify that the product requirements are met?
Exercise 2: Write Unit Tests
Circle and Sphere classes can be created.
Classes can be passed to procedures accepting the IFigure interface.
All properties work with minimum and maximum values.
All methods return expected results for two or more test cases.
To create unit tests in VBScript or JScript
Register the assembly for use with COM by running the RegAsm.exe utility from the Visual Studio .NET command prompt.
Copy the Windows Scripting Host (CScript.exe) to the folder containing the assembly to test.
Using Visual Studio .NET, Notepad, or some other editor, create the tests in VBScript or JScript.
Run the scripts from the Visual Studio .NET command prompt using the copy of CScript.exe in the assembly folder.
When you have finished, compare your results to those found in the sample files on the companion CD.
Exercise 3: Create a Load Test
Record at least five different requests to the server.
Add performance counters for the server s percentage of processor time, memory pages per second, and average disk read queue length.
Log the results to a Log folder within the Web application s folder structure.
Set the test properties to run for 30 seconds using four simultaneous connections.
Run the test.
View the performance counters for the server in chart form within ACT.
When you have finished, compare your results to the ACT sample recorded for the FlashCards sample application on the companion CD.
Exercise 4: Step Through a Remote Process
To step through a Web application running on a remote server
From your workstation, access the Web application using Microsoft Internet Explorer. This ensures that the Web application is running on the server when you try to attach to its process.
From the Visual Studio .NET Tools menu, choose Debug Processes. Select the server where the application is running, select the application s process (named aspnet_wp.exe), and then click Attach.
Set a breakpoint on the Page_Load function.
Switch to Internet Explorer, and click Refresh.
Switch back to Visual Studio .NET. The remote application should be paused at Page_Load.
Set breakpoints at other locations in code.
In Visual Studio .NET, click Continue to run to the next breakpoint.