How to: Register a New Test Condition
The following procedure explains how to register a new test condition.
To register a new test condition
Open a plain-text editor, such as Notepad.
Provide the following information, specifying your own assembly name, public key token, and extension type:
<?xml version="1.0" encoding="utf-8" ?> <extensions assembly="<enter assembly name here>, Version=1.0.0.0, Culture=neutral, PublicKeyToken=<enter key here>" version="1" xmlns="urn:Microsoft.VisualStudio.TeamSystem.Data.Extensions" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:Microsoft.VisualStudio.TeamSystem.Data.Extensions Microsoft.VisualStudio.TeamSystem.Data.Extensions.xsd"> <extension type="<enter extension type here>" enabled="true" /> </extensions>
The extension type is of the form "namespace.classname". The assembly name does not contain the ".dll" extension.
Save the file with the ".Extensions.xml" file name extension. For example, name the file "TestConditionName.Extensions.xml".
Add this file to the [Program Files]\Microsoft Visual Studio 8\DBPro folder.
Close Visual Studio.
Re-open Visual Studio.
Open a database project, and add a test project to it. Your new test condition appears in the Test Conditions pane of the Database Unit Test Designer.
Example
The following example shows the XML file that is required to register the test conditions that appear in the example at How to: Add a Test Condition to Database Unit Test Designer. You must substitute your own public key and assembly name. The assembly name in the following example is "CustomCondition".
<?xml version="1.0" encoding="utf-8" ?>
<extensions assembly="CustomCondition, Version=1.0.0.0, Culture=neutral, PublicKeyToken=<enter key here>" version="1" xmlns="urn:Microsoft.VisualStudio.TeamSystem.Data.Extensions" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:Microsoft.VisualStudio.TeamSystem.Data.Extensions
Microsoft.VisualStudio.TeamSystem.Data.Extensions.xsd">
<extension type="RowsAffected.RowsAffectedCondition" enabled="true" />
<extension type="TablesInResult.NumberOfTables" enabled="true" />
</extensions>
Security
Before you install a custom test condition that you did not create, you should understand the following risks:
The installer for the custom test condition might be malicious. It could be used to gain access to protected resources based on your installation permissions.
The custom test condition might be malicious. It could be used to gain control of protected resources if the user who executes the custom test condition has sufficient permissions.
To minimize your risk, you install custom test conditions only if they are from known sources. If you obtain a custom test condition from an untrusted source, you should inspect the source code for that custom test condition and its installer (if it has one) before you install and use the custom test condition.
See Also
Concepts
Terminology Overview of Team Edition for Database Professionals