Testing and Debugging



Testing and Debugging

OBJECTIVES

This chapter covers the following Microsoft-specified objectives for the "Testing and Debugging" section of Exam 70-320, "Developing XML Web Services and Server Components with Microsoft Visual C# .NET and Microsoft .NET Framework":

Create a unit test plan.

  • Before you release a product or component, the product needs to pass through different types of tests. This objective requires you to know the different types of tests that a product should undergo to verify its robustness, reliability, and correctness. These tests should be executed with a designed test plan that ensures that the product thoroughly meets its goals and requirements.

Implement tracing.

  • Configure and use trace listeners and trace switches.

  • Display trace output.

  • Tracing helps in displaying informative messages during the application's runtime to give you a fair idea of how the application is progressing. This objective requires you to know how to use Debug and Trace class properties and methods, attach trace listeners, and apply trace switches. You should also know how to use ASP.NET tracing in a Web application.

Instrument and debug a Windows service, a serviced component, a .NET Remoting object, and an XML Web service.

  • Configure the debugging environment.

  • Create and apply debugging code to components and applications.

  • Provide multicultural test data to components and applications.

  • Execute tests.

  • Use interactive debugging.

  • The process of debugging helps you locate logical or runtime errors in an application. This objective requires you to know the various tools and windows that are available in Visual C# .NET to enable easy and effective debugging. This objective also requires you to know the various techniques for debugging a Windows service, a serviced component, a .NET remoting object, and an XML Web service.

Log test results.

  • Resolve errors and rework code.

  • Control debugging in the Web.config file.

  • Use SOAP extensions for debugging.

  • Logging is the technique for collecting execution information for a program. The execution information can greatly help you in determining the cause of problem with the code. In this chapter you'll learn different techniques to enable logging in your applications. You should also know how to resolve errors, enable and disable debugging through the web.config file, and how to use SOAP extensions for debugging a Web service.

OUTLINE

Introduction

Testing

Creating a Test Plan

Executing Tests

Unit Testing

Integration Testing

Regression Testing

Testing International Applications

Tracing

Using Trace and Debug to Display Information

Trace Listeners

Trace Switches

Conditional Compilation

ASP.NET Tracing

ASP.NET Page-Level Tracing

ASP.NET Application-Level Tracing

Debugging

Configuring the Debugging Environment

Setting Breakpoints and Stepping Through Program Execution

Analyzing Program State to Resolve Errors

Debugging on Exceptions

Debugging a Running Process

Debugging a Remote Process

Debugging the Code in DLL files

Debugging Client-Side Scripts

Debugging a Windows Service

Debugging a Serviced Component

Debugging a .NET Remoting Object

Debugging an XML Web Service

Working with Event Logs

Working with Performance Counters

Chapter Summary

Apply Your Knowledge

STUDY STRATEGIES

  • Review the "Introduction to Instrumentation and Tracing" and "Using the Debugger" sections of the Visual Studio .NET Combined Help Collection.

  • Try calling different methods of the Trace and Debug classes. Note the differences in the output when you run a program using the Debug and Release configurations.

  • Experiment with attaching predefined and custom-made listeners to Trace objects. Refer to Step-by-Step 9.2 and Guided Practice Exercise 9.1 for examples.

  • Know how to implement trace switches and conditional compilation in applications. Refer to Step-by-Step 9.3 and Step-by-Step 9.4 for examples.

  • Experiment with the different types of debugging windows that are available in Visual C# .NET. Understand their advantages and learn to use them effectively. They can be very helpful in resolving errors.

  • Experiment with different debugging techniques such as local and remote debugging processes, debugging code in DLL files, and debugging SQL Server stored procedures.

  • Experiment with debugging different types of applications such as a Windows application, Web application, Web service, serviced component, .NET remoting object, and Windows service.