Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 38 additions & 2 deletions docs/test/configure-unit-tests-by-using-a-dot-runsettings-file.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Configure unit tests with a .runsettings file
description: Learn how to use the .runsettings file in Visual Studio to configure unit tests that are run from the command line, from the IDE, or in a build workflow.
ms.date: 12/17/2025
ms.date: 07/15/2026
ms.topic: how-to
ms.author: mikejo

Expand Down Expand Up @@ -150,6 +150,42 @@ To run tests from the command line, use *vstest.console.exe*, and specify the se

For more information, see [VSTest.Console.exe command-line options](vstest-console-options.md).

## Override run settings from the command line

You can also override some run settings directly from the command line. Specify run settings overrides after `--`. Include the space after `--`; all arguments after `--` are treated as run settings overrides, so these arguments must be last. Command-line run settings overrides take precedence over values from a file passed with `/Settings`.

```cmd
vstest.console.exe test.dll -- MSTest.MapInconclusiveToFailed=True MSTest.DeploymentEnabled=False
```

The same syntax works with `dotnet test` (use `dotnet test -- MSTest.MapInconclusiveToFailed=True`).

You can set **TestRunParameters** from the command line:

```cmd
vstest.console.exe test.dll -- TestRunParameters.Parameter(name="myParam", value="value")
```

Shell quoting rules differ. In Command Prompt, escape quotation marks as needed. In PowerShell 7.3 and later, native command argument handling supports this syntax more directly; in earlier PowerShell versions, or when `$PSNativeCommandArgumentPassing` is set to `legacy`, use the `--%` stop-parsing token. In Bash, escape characters such as parentheses, quotation marks, spaces, and semicolons.

In zsh (the default shell on macOS), use the same escaping as Bash: escape quotation marks, spaces, and semicolons. Because zsh also treats unquoted parentheses as globbing and array syntax, always escape or quote the parentheses in `TestRunParameters.Parameter(...)`. For example:

```zsh
vstest.console.exe test.dll -- TestRunParameters.Parameter\(name=\"myParam\",\ value=\"value\"\)
```

Parameter values can contain semicolons and other special characters, such as connection strings, but the shell must pass them through literally. For complex values, consider using a *.runsettings* file instead:

```xml
<RunSettings>
<TestRunParameters>
<Parameter name="connectionString" value="Server=localhost;Database=mydb;Trusted_Connection=True" />
</TestRunParameters>
</RunSettings>
```

For more command-line examples and shell-specific quoting details, see [Passing runsettings arguments through the command line](https://github.com/microsoft/vstest/blob/main/docs/RunSettingsArguments.md).

## The *.runsettings file

The *.runsettings file is an XML file that contains different configuration elements within the **RunSettings** element. The sections that follow detail the different elements. For a complete sample, see [Example *.runsettings file](#example-runsettings-file).
Expand Down Expand Up @@ -511,6 +547,6 @@ The **RunConfiguration** node should contain an **EnvironmentVariables** node. A

## Related content

- [Configure a test run](https://github.com/microsoft/vstest-docs/blob/main/docs/configure.md)
- [Configure a test run](https://github.com/microsoft/vstest/blob/main/docs/configure.md)
- [Customize code coverage analysis](../test/customizing-code-coverage-analysis.md)
- [Visual Studio test task (Azure Test Plans)](/azure/devops/pipelines/tasks/test/vstest?view=vsts&preserve-view=true)
4 changes: 2 additions & 2 deletions docs/test/migrate-testsettings-to-runsettings.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Migrate testsettings to runsettings
description: Learn how to migrate testsettings to runsettings
ms.date: 03/18/2021
ms.date: 07/17/2026
ms.topic: upgrade-and-migration-article
f1_keywords:
- vs.UnitTest.Migrate
Expand Down Expand Up @@ -34,7 +34,7 @@ SettingsMigrator.exe E:\MyTest\MyTestSettings.testsettings
SettingsMigrator.exe E:\MyTest\MyTestSettings.testsettings E:\MyTest\MyNewRunSettings.runsettings
```

If you're interested in reading more on how the *.testsettings* options convert to *.runsettings* you can find more implementation details in the [open source test platform repository](https://github.com/microsoft/vstest-docs/blob/main/RFCs/0023-TestSettings-Deprecation.md#migration) on GitHub.
If you're interested in reading more on how the *.testsettings* options convert to *.runsettings*, you can find more implementation details in the [open source test platform repository](https://github.com/microsoft/vstest/blob/main/docs/RFCs/0023-TestSettings-Deprecation.md#migration) on GitHub.

## Related content

Expand Down
Loading