How to: Register a New Test Type

These are the two ways to register a test type, with and without TUIP implementation. For step-by-step instructions, see the following procedures:

  • Register a Test Type with TUIP Implementation

  • Register a Test Type without TUIP Implementation

Note   A TUIP is a "test-type UI provider." Every test type that has custom user interface elements requires a TUIP. Every TUIP must define a service that implements the ITuip and ICommandProvider interfaces.

Register a Test Type with TUIP Implementation

These are the steps for registering a test type with TUIP implementation:

  1. Add appropriate attributes to test-type implementation classes.

  2. Move your test type implementation DLLs to the correct location on disk.

  3. Add registry entries for your test type by running regpkg.

Add Attributes to Test-Type Implementation Classes

To add attributes to test-type implementation classes

  • RegisterTestType. If you provide a test type with your customized user interface, including an editor for your test type, you should use the RegisterTestTypeAttribute to decorate your Visual Studio package. This also handles the editor factory registration for you.

    RegisterTestType takes the following parameters:

    • TestType name.

    • ITip implementation class name.

    • Editor factory class name.

    • Priority. This determines the priority according to which the editor factory for the extension is called. What value should you use? It depends on the priority used by other editor factories for the same extension, if any. You can determine what other priorities are in use by looking up registry entries for factories registered with the same extension.

    • extension of the file types handled by this editor/tip. The extension should contain a leading “.”

    • resource ID for the icons of this test type, one for each file extension.

    • resource ID for the string representation of the test type.

    • resource ID for the name of the test editor.

    In all cases, resource IDs point to the satellite DLL of the package.

    Example:

    [RegisterTestType(typeof(MyTest), typeof(MyTestTip), typeof(MyTestEditorFactory), 100, new string[] { ".mytest" }, new int[] { (int)ResourceIds.MyTestIcon }, (int)ResourceIds.MyTestName, (int)ResourceIds.MyTestEditorCaption)]

  • RegisterTestTypeNoEditor. If you provide a test type with custom user interface but not an editor for your test type, you should use the RegisterTestTypeNoEditorAttribute to decorate your Visual Studio package.

    RegisterTestType takes the following parameters:

    • TestType name.

    • ITip implementation class name.

    • extension of the file types handled by this editor/tip. The extension should contain a leading “.”

    • resource ID for the icon of this test type, one for each file extension

    • resource ID for the string representation of the test type

    • resource ID for the name of the test editor

    In all cases, resource IDs point to the satellite DLL of the package.

    Example:

    [RegisterTestTypeNoEditor(typeof(MyTest), typeof(MyTestTip), new string[] { ".mytest" }, new int[] { (int)ResourceIds.MyTestIcon }, (int)ResourceIds.MyTestName)]

  • ProvideServiceForTestTypeAttribute. Use the ProvideServiceForTestTypeAttribute to decorate your Visual Studio package, in order to wire up the TUIP implementation with the test type.

    [ProvideServiceForTestType(typeof(MyTest), typeof(SMyTestService))]

    ProvideServiceForTestType takes in as parameters the TestType name and your Visual Studio service type that provides the TUIP implementation.

  • ProvideToolWindowAttribute. Use the ProvideToolWindowAttribute to register your test-results custom viewer. Please refer to VSIP documentation for more details.

Move Test-Type DLLs

To move your test-type DLLs

  • Move all your test type implementation DLLs, including TestElement, TIP, TUIP implementations, your package DLL and other DLLs you created that support the test type, to this location on your hard drive:

    %VisualStudioPath%\Common7\IDE\PrivateAssemblies

    You should have a satellite DLL that goes along with your Visual Studio package DLL. Move the satellite DLL to this location on disk:

    %VisualStudioPath%\Common7\IDE\PrivateAssemblies\1033

Register Your Test Type

To register your test type

  • After decorating your classes, run the program that is found at this location:

    %VSIP_DIRECTORY%\EnvSDK\tools\bin\x86\regpkg.exe

    This program finds these attributes in the binaries and updates the registry so that the types are recognized by the test environment.

Register a Test Type Without TUIP Implementation

You may have chosen to provide a simple test type that implements nothing other than the basic test type that is described in How to: Implement a Basic Test Type. The steps for registering such a test type without TUIP implementation are:

  1. Move your test type implementation DLLs to the correct location on disk.

  2. Add registry entries for your test type.

Move Test-Type DLLs

To move your test-type DLLs

  • Move all your test type implementation DLLs, including TestElement and TIP implementation and other DLLs you created that support the test type, to the following folder:

    %VisualStudioPath%\Common7\IDE\PrivateAssemblies

    You must have a satellite DLL that provides the name and icon for your test type. Move the satellite DLL to the following folder:

    %VisualStudioPath%\Common7\IDE\PrivateAssemblies\1033

Add Registry Entries

To add registry entries

  1. Add the GUID for your test type as a subkey underneath HKLM\Software\Microsoft\VisualStudio\8.0\EnterpriseTools\QualityTools\TestTypes. With the new subkey, add the following string values:

    • SatelliteDllName. Name of your satellite DLL, which contains the name and icon for your test type

    • SatelliteBasePath. Path to your satellite DLL up to but without the localization code directory (e.g. 1033)

    • NameId. In the format of #Id, where Id is Resource ID of the test type name, pointing to your satellite DLL

    • TipProvider. Full assembly name of your DLL that implements ITip

  2. Under the new subkey, add a new subkey named Extensions.

  3. With the Extensions subkey, add one new DWORD Value for each file extension that your test type supports. For each DWORD Value, the Data should be the resource ID of the corresponding icon in the satellite DLL.

See Also

Concepts

Packaging and Installing Test Type Extensions in Visual Studio Team System

How to: Implement a Basic Test Type

Implementing Custom Test Types