Udostępnij za pośrednictwem


Working with Unit Tests

Unit tests give developers and testers a quick way to check for logic errors in the methods of classes in C#, Visual Basic .NET, and C++ projects. A unit test can be created one time and run every time that source code is changed to make sure that no bugs are introduced.

Note

Visual Studio 2008 Team Edition for Developers offers two test-related capabilities that were not available in Visual Studio 2005 Team Edition for Developers. First, you can now manage test lists. For more information, see Managing Large Numbers of Tests. Also, you can now obtain code coverage data when you run tests. For more information, see How to: Obtain Code Coverage Data.

For information about test-related capabilities for users of Visual Studio Professional Edition, see Using Testing Tools in Visual Studio Professional Edition.

In This Section

  • Anatomy of a Unit Test.
    Describes the parts of a unit test and the files that are added to your solution when you create a unit test with the Visual Studio Team System testing tools.

  • Creating Unit Tests
    Provides links to topics about how to create unit tests, including data-driven unit tests and unit tests for DLLs and EXEs for which you do not have the source code.

  • Special Considerations for Unit Tests and C++, Generics, Web Services, and Smart Devices
    Provides links to topics that describe differences and additional information about unit tests and C++, Generic methods, Web Services, and Smart Devices.

  • Walkthrough: Creating and Running Unit Tests
    Leads you through the steps to create and customize unit tests, run them, and examine the test results.

  • Walkthrough: Run Tests and View Code Coverage
    Builds on a previous walkthrough to show how to view code coverage data, which shows the proportion of your project's code that is being tested.

Reference

  • Managing Tests
    Describes aspects of working with tests, including how to customize and filter test views, how to work with test lists, and how to associate tests with work items.

  • Running Tests
    Describes many aspects of running tests, including how to configure test runs, how to run tests in the Visual Studio IDE and on a command line, and how to debug while you are running a test. 

  • Analyzing Test Results
    Describes test results and ways to work with them, including how to view, save, and publish them and how to create bugs from them.

  • Working with Web Tests
    Describes how to create, edit, run, and view Web tests.

  • Working with Load Tests
    Describes the uses of load tests, how to edit and run them, how to collect and store load test performance data, and how to analyze load test runs.

  • Working with Manual Tests
    Describes how to create and run manual tests, the only non-automated test type.

  • Working with Generic Tests
    Describes how to create and run generic tests. Generic tests wrap external programs and tests that were not originally developed for use in the Team System testing tools.

  • Working with Ordered Tests
    Describes how to create ordered tests, which contain other tests that are meant to be run in a specified order.

  • Walkthroughs for Test Edition
    Provides links to the walkthroughs that step you through the use of the built-in test types and other topics, such as the collection of code-coverage data.