Share via


How to: Create a Generic Test

A generic test wraps an existing test, program, or third-party tool. After that program has been wrapped as a generic test, Team System testing tools treats it like any other test type: You can manage and run it and obtain results using the same Visual Studio Team System Test Edition windows and tools. 

Note

The following procedure presumes that you have an existing test, program, or third-party tool in the form of executable file to wrap as a generic test. You must be able to run this executable file from the command line, and it must return a value of Pass or Fail.

For more information, see Generic Tests Overview.

To create a generic test

  1. In Solution Explorer, right-click a test project, point to Add, and then click Generic Test.

    A template for a generic test is added to your test project and opened in the main editing window. The new generic test is given a default name, such as GenericTest1.generic, and is displayed in Solution Explorer within the test project.

  2. Under Specify an existing program (a test, test harness, or test adapter) to wrap as a generic test, indicate the path and file name of the test, program, or third-party tool to wrap into a generic test.

  3. (Optional) Under Command line arguments to pass to the generic test, type one or more arguments to pass. Separate multiple arguments with spaces.

  4. (Optional) Under Additional files to deploy with this generic test, specify any files that the test must have to run correctly.

    Note

    Before the test runs, the files that you specify in this step are copied to a deployment directory that is created by Visual Studio. For more information, see Generic Tests Overview.

  5. (Optional) Under Working Directory, specify a directory that the executable file is to use as a working directory as it runs.

  6. (Optional) Specify the name of a results file.

  7. Save the generic test.

The test is now ready to run; it will return a result of 0 or another number. The test engine interprets 0 as Passed and any other number as Failed.

Security

Not only can a generic test call any executable program on your computer, it uses your credentials as it does so. For this reason, make sure you trust the author of the program and know what the program will do.

See Also

Tasks

Walkthrough: Creating and Running a Generic Test

Concepts

Generic Tests Overview