VSTest.Console.exe

The VSTest.Console.exe in Visual Studio discovers and runs tests, including Test Studio Dev tests and test lists.

The VSTest Console is a CLI tool you can access from the Visual Studio developer command prompt.

There are two prerequisites to run test studio tests with the vstest.console.exe:

Visual Studio 2015

To execute tests, simply call the vstest.console.exe with "yourtest.tstest" as argument.

Note! If you have unit tests you also need to specify the project .dll in the vstest.console arguments as shown in this example: vstest.console bin\debug\TestStudioProject.dll WebTest.tstest

Start test

Any results you output will appear in the vstest.console result deployment folder which by default resides in the project root. "{projectpath}\TestResults".

Visual Studio 2017 and Later

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 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 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 are listed sample commands to execute a Test Studio test and test list with the VSTestConsole.exe in Visual Studio 2019, after the TS_PROJECT_PATH and TS_DLL_PATH variables are set for the current instance of the VS Developer Command Prompt:

trigger Parent.tstest run

C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\CommonExtensions\Microsoft\TestWindow>vstest.console.exe "C:\Projects\TestStudioProject11\TestStudioProject11\Parent.tstest" /TestAdapterPath:"C:\Program Files (x86)\Progress\Test Studio\VS2019"

trigger sampleList.aiilist run

C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\CommonExtensions\Microsoft\TestWindow>vstest.console.exe  "C:\Projects\TestStudioProject11\TestStudioProject11\TestLists\sampleList.aiilist" /TestAdapterPath:"C:\Program Files (x86)\Progress\Test Studio\VS2019"

Note! In addition to all of the above, for vstest.console.exe 15+ (distributed with VS2017 and later) the libraries listed below should be also installed in the GAC or copied and referred in the project from the folder, where the TestAdapter dll is - C:\Program Files (x86)\Progress\Test Studio\VS2017 for VS 2017 and C:\Program Files (x86)\Progress\Test Studio\VS2019 for VS 2019. Libraries to be included:

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

    You can find the libraries in the Test Studio install folder: C:\Program Files (x86)\Progress\Test Studio\Bin. Check the article above on some details on how to GAC assemblies in the Global Assembly Cache.
In this article
Not finding the help you need? Improve this article