Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

How to: Open a Database Unit Test to Edit

This topic applies to:

Visual Studio Ultimate

Visual Studio Premium

Visual Studio 2010 Professional 

Visual Studio Express

Topic appliesTopic appliesTopic does not applyTopic does not apply

After you create a database unit test, you use the Database Unit Test Designer to add Transact-SQL statements and test conditions. The tests created by using the designer generate Visual C# or Visual Basic code. This code is what executes when your test runs. 

If the test that you create tests the database object to your satisfaction, you can run it as it is. If you want to add more functionality to this database unit test, you can edit its code. This code resides in a .cs or .vb file in your test project. For more information, see Database Unit Test Files. You can also customize your tests by creating new test conditions. For more information, see How to: Create Test Conditions for the Database Unit Test Designer.

NoteNote

If you delete a test method by editing the .cs or .vb file, the test method still appears in the Database Unit Test Designer. This situation occurs because the InitializeComponent method of the test class still contains member variables for that test. Although the test appears in the designer, you cannot run the test because its code is no longer present. To regenerate the test method for this test, edit the Transact-SQL in the editor, and then either save the .cs or .vb test file or rebuild the test project.

To open the source code file of a database unit test from Solution Explorer

  • In Solution Explorer, right-click the source-code file that contains the database unit test, and then click View Code.

    In the main editing window of Visual Studio, the test method of the database unit test appears when the file opens.

To open the source code file of a database unit test from the Test View window

  1. Run a database unit test.

  2. In the Test View window, right-click the test, and then click Open Test.

    In the main editing window of Visual Studio, the test method of the database unit test appears when the file opens.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.