How to: Create Test Conditions for the SQL Server Unit Test Designer
09/10/2025 You can use the extensible TestCondition class to create new test conditions. For example, you might create a new test condition that verifies the number of columns or the values in a r
You can use the extensible
TestCondition
class to create new test conditions. For example, you
might create a new test condition that verifies the number of columns or the values in a result
set.
This procedure explains how to create a test condition to appear in the SQL Server Unit Test
Designer.
-
In Visual Studio, create a class library project.
-
On the
menu, select.
- Select the
tab.
- In the
list, select
and then
select.
- Add the required assembly references. Right-click the project node and then select. Select
and navigate to the
folder. Choose Microsoft.Data.Tools.Schema.Sql.dll and select
,
then select.
- On the
menu, select.
- Right-click on the project in
and choose.
- Add the following
statements after the import of
:
XML
C:\Program Files (x86)\Microsoft SQL
Server\110\DAC\Bin
Import
Microsoft.CSharp.targets
<Import
Project
=
"$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\SSDT\Microso ft.Data.Tools.Schema.Sql.UnitTesting.targets"
Condition
=
"'$(VisualStudioVersion)' == ''"
/>
<Import
Project
=
"$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVer sion)\SSDT\Microsoft.Data.Tools.Schema.Sql.UnitTesting.targets"
Condition
=
"'$(VisualStudioVersion)' != ''"
/>