Execute Test Studio Tests with VSTestConsole.exe

To be able to execute Test Studio tests with the Visual Studio default test runner there are few requirements to set in advance. These are described below:

1.  Start the VS Developer Command Prompt with Admin privilege.

2.  Change the working folder to be the one which contains the vstest.console.exe. This depends on the Visual Studio installation:

  • for Visual Studio 2015 it is C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow
  • for Visual Studio 2017 Enterprise it is C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TestWindow
  • for Visual Studio 2019 Professional it is C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\CommonExtensions\Microsoft\TestWindow

3.  There are two variables you have to set before executing Test Studio tests - TS_PROJECT_PATH and TS_DLL_PATH. Project path is the folder which contains the Settings.aiis file. Dll path is the folder which contains the built project dll.

set TS_PROJECT_PATH=C:\Visual Studio 2015\Projects\TestStudioProject11\TestStudioProject11

set TS_DLL_PATH=C:\Visual Studio 2015\Projects\TestStudioProject11\TestStudioProject11\bin\Debug\TestStudioProject11.dll

Note! The variables are set for this instance of the Developer Command Prompt. By each next start of the command prompt the variables need to be set again. Therefore these need to be set in the build tasks in CI environment prior the task to execute the test.

4.  To be able to execute a Test Studio test, you need to include the /TestAdapterPath:[path] argument, except the full path to the *.tstest file - this is the Telerik.TestStudio.TestAdapter-VS2015.dll. The location of this dll depends on the Visual Studio installation:

  • for Visual Studio 2015 the TestAdapter.dll is in any of the sub-folders in the Visual Studio Extensions directory, which is C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\
  • for Visual Studio 2017 Enterprise the TestAdapter.dll is deployed in a sub folder of the Test Studio installation folder C:\Program Files (x86)\Progress\Test Studio\VS2017
  • for Visual Studio 2019 Professional the TestAdapter.dll is deployed in a sub folder of the Test Studio installation folder C:\Program Files (x86)\Progress\Test Studio\VS2019

Below is listed a sample command to execute a Test Studio test with the VSTestConsole.exe in Visual Studio 2015, after the TS_PROJECT_PATH and TS_DLL_PATH variables are set for the current instance of the VS Developer Command Prompt:

C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow>vstest.console "C:\Visual Studio 2015\Projects\TestStudioProject11\TestStudioProject11\Parent.tstest" /TestAdapterPath:"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\t1fos0ab.vkx"

Note! In addition for vstest.console.exe 15+ (distributed with VS2017 and later) the libraries listed below should be included in the GAC or in "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\CommonExtensions\Microsoft\TestWindow\Extensions". Libraries to be included:

  • Autofac
  • Newtownsoft.json
  • Telerik.TestStudio.Shared

    You can find the libraries in the Test Studio install folder: C:\Program Files (x86)\Progress\Test Studio\Bin.
In this article
Not finding the help you need? Improve this article