Uredi

Deli z drugimi prek


How to: Run SQL Server Unit Tests

You can run a SQL Server unit test in any one of several ways, such as using various windows and the Command Prompt window.

Note

You cannot run unit tests remotely.

The ways that are available to you depend on the software that you installed, as described in Running SQL Server Unit Tests.

To run SQL Server unit tests using Test View (Visual Studio 2010)

  1. On the Test menu, point to Windows, and then click Test View.

    The Test View window opens.

  2. In the Test View window, click the test or tests that you want to run. By using the CTRL key or the SHIFT key, you can specify discontinuous or continuous blocks of tests.

  3. Do either of the following:

    • Right-click the surface of the Test View window, and then click Run Selection.

    • On the Test View toolbar, click Run Selection.

To run SQL Server unit tests using Test Explorer (Visual Studio 2012)

  1. On the Test menu, point to Windows, and then click Test Explorer.

    The Test Explorer window opens.

  2. In the Test Explorer, click the test or tests that you want to run. By using the CTRL key or the SHIFT key, you can specify discontinuous or continuous blocks of tests.

  3. Right-click one of the highlighted tests and click Run Selected Tests.

To run SQL Server unit tests from the SQL Server Unit Test Designer (Visual Studio 2010)

  • On the Test Tools toolbar, you will find buttons to start a project with or without the debugger.

This step runs all tests in the current test run. As soon as you start a test run, the Test Results window appears and displays the progress of the test run. This display includes tests that are running and tests that have completed. For more information, see Interpreting SQL Server Unit Test Results.

See Also

Running SQL Server Unit Tests
How to: Run Automated Tests from Microsoft Visual Studio 2010
Running Automated Tests from the Command Line (Visual Studio 2010)
Testing the Application (Visual Studio 2012)