Internet Explorer is no longer supported. Many things will still work, but your experience will be degraded and some things won't function. Please use a modern browser such as Edge, Chrome, or Firefox.

Execute VSTest Tests

Modified on July 26, 2024

Runs VSTest unit tests on a specified test project, recommended for tests in VS 2012 and later.

Script usage:

WindowsSDK::Execute-VSTest(
	TestContainer: <text>,
	[Group: <text>],
	[Arguments: <text>],
	[ClearExistingTestResults: <true/false>],
	[VsTestPath: <text>]
);

Arguments:

NameFormatScript UsageUsage Notes
Test container
text
TestContainer
This argument is required.
Test group
text
Group
Value note: "Unit Tests".
Additional arguments
text
Arguments
Clear existing results
true/false
ClearExistingTestResults
When true, the test results directory will be cleared before the tests are run.
VSTest Path
text
VsTestPath
The path to vstest.console.exe, typically:

%VSINSTALLDIR%\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe

Leave this value blank to auto-detect the latest vstest.console.exe using vswhere.exe.
Default value is "$VSTestExePath".