New to Telerik Test Studio? Download free 30-day trial

Execute Test Studio Dev Tests with VSTest.Console.exe

The VSTest.Console.exe is the Visual Studio command-line command that is used to run tests, including Test Studio Dev recorded tests and test lists.There are few prerequisites to setup in order to enable a machine to execute Test Studio Dev tests and test lists via the VSTest.Console.exe.

This article describes all necessary settings, as well as example commands.

Install Test Studio Dev Specific DLLs in GAC

Install Autofac.dll and Newtownsoft.Json.dll in the GAC (Global Assembly Cache). The mentioned dll files are distributed in the Test Studio Dev installation folder under the bin subfolder. The default install location is C:\Program Files (x86)\Progress\Test Studio\.

Tip

Read how to install a dll file in the GAC if you need help on the topic.

Configure the VS Developer Command Prompt

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

2.  Change the working folder to the one, which contains the vstest.console.exe. Choose it depending on the Visual Studio installation you have:

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

3.  Set the following two variables - TS_PROJECT_PATH (the folder, which contains the Test Studio project Settings.aiis) and TS_DLL_PATH (the folder, which contains the built project dll - by default it is in the project root under \bin\Debug).

set TS_PROJECT_PATH=C:\Projects\TestStudioProject11\TestStudioProject11

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

Important!

These variables are set for the current instance of the Developer Command Prompt. By each next start of the command prompt the variables need to be set again.

Thus, if executing the tests as part of CI setup, include tasks in the build to set these two variables prior the task to run the test scripts.

List the VSTest.Console.exe Command

1.  To trigger execution of Test Studio Dev tests from the VSTest.Console.exe you need to force its process to use custom test adapters from a specified path in the test run. This is listed with the argument /TestAdapterPath:[path] and the Telerik.TestStudio.TestAdapter-VS20XX.dll to choose depends on the Visual Studio version in use:

  • Visual Studio 2015 - the TestAdapter.dll is deployed in a sub folder of the Test Studio installation folder C:\Program Files (x86)\Progress\Test Studio\TestAdapterVS2015
  • Visual Studio 2017 - the TestAdapter.dll is deployed in a sub folder of the Test Studio installation folder C:\Program Files (x86)\Progress\Test Studio\VS2017
  • Visual Studio 2019 - the TestAdapter.dll is deployed in a sub folder of the Test Studio installation folder C:\Program Files (x86)\Progress\Test Studio\VS2019
  • Visual Studio 2022 - the TestAdapter.dll is deployed in a sub folder of the Test Studio installation folder C:\Program Files (x86)\Progress\Test Studio\VS2022

2.  It is recommended to use the argument /Settings:[fullPathToFile] (it is mandatory for VS 2019), which allows you to pass different run settings for the test execution. This argument accepts the *.testsettings file used to control the execution from the Test Explorer

Example Commands

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" /Settings:"C:\Projects\TestStudioProject11\TestStudioProject11\TestSettings1.testsettings

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" /Settings:"C:\Projects\TestStudioProject11\TestStudioProject11\TestSettings1.testsettings
In this article