How to make your extension visible to the test explorer in Visual Studio 11?

There are few different ways by which you can make your extension visible to test explorer in Visual Studio 11. Let us go through them one by one.

1. Drop it in “Extensions” folder

This is the most simplest way to make the extension visible and it works for all the 3 well known clients (VS, command-line, team build). The exact steps are as follows: -

  • Find the installation directory of UTE. (On my x86 machine, it is something like C:\Program Files\Microsoft Visual Studio 11.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow)
  • You will observe an extensions folder in that directory. Copy your extension and its dependencies in that Extensions folder.
  • Restart your client and after that the extension should be visible to the test explorer in Visual Studio 11.

2. Install the VSIX provided by the extension provider

This is another simple way to make the extensions visible and it works for almost all the scenarios. The only place where it does not work is with a 64 bit team build system. The exact steps are as follows: -

  • Install the VSIX provided by the extension provider.
  • Restart your client and after that the extension should be visible to the test explorer in Visual Studio 11.

Notes: -

  • If the extension is supposed to be installed on a team build machine, then you should specify that the extension is valid for all the users. This is required if the account under which “build controller/agent” will be run and the account under which vsix is installed is different.
  • The extension is not visible to build controller on a 64 bit machine. The reason is that the extension manager library which understands vsix extensions is supported only in x86 processes and not on x64 processes. Our other clients (VS/command-line) are x86 based, so it works with them but team build runs as 64 bit process on a 64 bit machine due to which it does not work with it.

3. Check-in the extension in the version control

This makes the extension visible only for team build machine and is not applicable for VS and command-line clients. The exact steps are as flows: -

  • Check-in the extension and its dependencies in version control.
  • Specify the path where it is checked-in in the build controller properties.
    • Open Manage build controller (VS –> connect to Tfs –> Build –> Manage build controllers).
    • Select your build controller.
    • Specify the path in the section “version control path to custom assemblies”.
  • Now queue a build and your adapter should be visible to the build controller/agent.

4. Use Nu-get extensions (Updated 29/8)

As Tejre mentioned here, you can also make your extensions visible via Nuget packages. This support was not available in Visual Studio 11 and got added in an update and it works for all the 3 clients (VS, command-line, team build). The exact steps for VS/team build are: -

  • Add the relevant nu-get package, which contains the adapter, as a reference to the project.
  • Build the project and you will be able to run the tests.

 

For command-line, you should specify /TestAdapterPath switch to pass on nuget adapter location. Example: -

vstest.console /TestAdapterPath:"C:\Users\aseemb\Desktop\UnitTestProject1\packages" "C:\Users\aseemb\Desktop\UnitTestProject1\UnitTestProject1\bin\Debug\UnitTestProject1.dll"