Test Projects

Visual Studio Team System offers a new project template called "Test Project." Projects of this type provide a convenient way to store tests of any kind. You may decide to have all of the tests in your test project be of one type, or you may mix different types of tests within the same test project.

The types of tests that can be contained in a test project include the following:

  • Unit tests: These are low-level tests verifying that target application code functions as the developer expects. Unit tests are essentially code that tests other code. Because unit tests are normally written by the developer but are also a testing activity, they are available in both the Software Developer and Software Tester editions of Team System. Unit testing is a growing practice and is rapidly becoming an indispensable part of the development process at many companies. Unit testing and the related practice of test-driven development are described in detail in Chapter 14.

  • Web tests: Used to verify functionality of a web application, a web test can be created through the IDE or written with code. For example, you may create a web test to verify that a user can create a new account on your site. This web test could be one of a suite of web tests that you run periodically to verify that your website is working as you expect. For more information, see Chapter 15.

  • Load tests: These tests verify that a target application will perform and scale as necessary. A target system is stressed by repeatedly executing a variety of tests. Team System records details of the target system's performance and automatically generates reports from the data. Load tests frequently are based on sets of web tests for verifying web applications. However, non-web applications can be tested by selecting a number of unit tests to execute. For more information, see Chapter 15.

  • Manual tests: These tests allow a manual process, such as one described in a text document, to be carried out, with the results recorded in Team System. A manual test might be a detailed step-by-step use case or scenario that could be difficult to automate. Many companies strongly rely on manually conducted tests. Integration of manual testing enables such companies to continue those practices, with success and failure recorded by Team System, without requiring the expense of conversion. For details, see Chapter 16.

  • Generic tests: These tests enable calling of alternative external testing systems, such as an existing suite of tests leveraging a third-party testing package. Results of those tests can be automatically parsed to determine success. This could range from something as simple as the result code from a console application to parsing the XML document exported from an external testing package. For more information, see Chapter 17.

  • Ordered tests: Essentially containers of other tests, these establish a specific order in which tests are executed and enable the same test to be included more than once. For details, see the section "Using Ordered Tests" later in this chapter.

Placing your tests in a test project has the additional benefit of keeping them separate from your implementation code, reducing the risk that you'll accidentally deploy test code to your production environment.

Later in this chapter, we'll describe test management in detail, including use of the Test Manager and test lists to organize and execute collections of tests.

Creating a test project

There are a number of ways to create a new test project. You can create a test project before you create any tests or you can create one as you are creating a new test.

To create a test project before creating any tests, you can right-click on an existing solution and choose Add image from book New Project. You may instead use the File menu, also selecting Add image from book New Project. You will see the Add New Project dialog, as shown in Figure 13-1.

image from book
Figure 13-1

Under Project Types, choose the Test category under the language you wish to use for your tests, if applicable. Select Test Project from the Templates list and assign a name to your project. If you do not already have a solution, you will be able to create one as well.

When creating tests, Visual Studio will offer to automatically create a test project for you if you do not already have one. We discuss this later in the chapter.

When your test project is created, Visual Studio adds two files to your solution's Solution Items folder. One is the test run configuration, an XML file named localtestrun.testrunconfig. This file contains the various settings that determine how your tests will be executed. You can double-click on this file to display those settings. We'll cover test run configuration settings throughout the next few chapters.

The other file, known as the test meta-data file, is also XML-based and is named <ProjectName=.vsmdi. This file stores information about your solution's test lists and links to any contained tests. Double-clicking this file will open Test Manager. We'll discuss the use of this file later in this chapter.

Setting test project options

You may notice that the test project you have created is not empty. By default, a number of files will be included with your new test project. These include an "About Test Projects" text file that introduces test projects as well as sample unit and manual tests. These serve as helpful starting points to add your tests, but you can safely delete these if you choose. To change what types of files are added to a new test project, select Tools image from book Options. On the resulting Options dialog, expand the Test Tools category and select Test Project. You will see options as shown in Figure 13-2.

image from book
Figure 13-2

You may set the default language for new test projects using the drop-down list at the top. This setting will save you some time later, as you will not need to choose the language each time you create a new test project, though you always have the option to override this setting.

Below that, you will see a list of file types organized by test project language. Notice that several file types are already selected for you. The types of files that are automatically included can be specified by language type. For example, you may wish that VB.NET test projects are always created empty, while your C# test projects include the "About Test Projects" help file. Select which files you wish included, if any, and press OK.

Professional Visual Studio 2005 Team System
Professional Visual Studio 2005 Team System (Programmer to Programmer)
ISBN: 0764584367
EAN: 2147483647
Year: N/A
Pages: 220

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