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

Execute Test Studio Tests with VSTest.Console.exe

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

There are few requirements in order to execute Test Studio tests and test lists with the Visual Studio test runner VSTest.Console.exe. Follow the steps below to be able to trigger test runs with VSTest.Console.exe.

1.  Install Autofac.dll and Newtownsoft.Json.dll in the GAC (Global Assembly Cache). The dll files are stored in the Test Studio installation folder in the bin subfolder - the default location is C:\Program Files (x86)\Progress\Test Studio\Bin.

Tip

Check the Microsoft documentation on how to install a dll file in the GAC (Global Assembly Cache).

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

3.  Change the working folder to this, which contains the vstest.console.exe. Depending on the Visual Studio installation this can be:

  • 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

4.  Set these 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.

Therefore, if the tests are executed as part of CI setup, the two variables need to be set in the build tasks prior the task to run the test scripts.

5.  The execution of Test Studio tests with VSTest.Console.exe requires the usage of the argument /TestAdapterPath:[path] - this is the Telerik.TestStudio.TestAdapter-VS20XX.dll and can be found in the folder corresponding to the Visual Studio version in use:

  • 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

6.  Visual Studio 2019 requires the argument /Settings:[file name], which accepts a Visual Studio Test Explorer project settings file.

Examples

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