How to run tests on a machine without Visual Studio/Team Build/Test agent etc?
I have heard a lot of customers ask about how to make the tests run on a machine without visual studio components or whether you have xcopy-able install etc.
The official answer to all these questions is that you should have a visual studio or team build or test agent installed on the box, but unofficially there is a way by which you can make “pure” unit test work. Here are the steps you can perform to achieve this: -
- Copy TestWindow folder *%Visual Studio Installation Dir%\Common7\IDE\CommonExtensions\Microsoft\TestWindow) from a machine which has visual studio to any folder on the target machine (let’s call that folder c:\TestWindow).
- Copy a few binaries from the GAC of visual studio machine to C:\TestWindow folder of the target machine. These binaries are
- Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll (You have to copy 10.0.0.0 version as will find 2 assemblies there. )
- Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel.dll.
- Microsoft.VisualStudio.QualityTools.Common.dll
- Microsoft.VisualStudio.QualityTools.Resource.dll
- This makes the framework ready, now when you copy the test binaries, ensure that the unit test framework assembly (Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll) is also copied & it is present in the same directory as the test assembly.
- Now try running the tests using vstest.console and it should work.
Notes: –
- This is not supported scenario and there is a good probability that in subsequent release, this may stop working.
- This approach can be used only to run pure unit tests and will not work if you have test settings, coded ui test, host adapter tests etc.
I personally feel that even with all the caveats, still this is useful, hence this post. Enjoy !!
Comments
- Anonymous
February 12, 2014
Actually it's only a few lines of code to write a tool that can use reflection to read out all the unit tests from a dll and run them anyway, even if it doesn't do everything mstest does. - Anonymous
August 06, 2015
The comment has been removed