From 0d63840163edd3abad1739ec76623a07b97ef8fc Mon Sep 17 00:00:00 2001 From: Azat Mukhametshin Date: Mon, 13 Jul 2026 16:30:11 +0200 Subject: [PATCH 1/8] Add missing vstest docs details Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4e840b63-ad95-40c2-9ef8-5f2fcc4cfdaa --- docs/core/testing/selective-unit-tests.md | 17 ++++++++++++++++- docs/core/tools/dotnet-test-vstest.md | 18 ++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/docs/core/testing/selective-unit-tests.md b/docs/core/testing/selective-unit-tests.md index 7a5d0eee4ea68..9d329713f857f 100644 --- a/docs/core/testing/selective-unit-tests.md +++ b/docs/core/testing/selective-unit-tests.md @@ -31,7 +31,7 @@ dotnet test --filter | -------------- | -------------------- | | MSTest | `FullyQualifiedName`
`Name`
`ClassName`
`Priority`
`TestCategory` | | xUnit | `FullyQualifiedName`
`DisplayName`
`Traits` | - | Nunit | `FullyQualifiedName`
`Name`
`Priority`
`TestCategory` | + | Nunit | `FullyQualifiedName`
`Name`
`Priority`
`TestCategory`
`Category`
`Property` | * **Operators** @@ -44,6 +44,21 @@ dotnet test --filter ## Character escaping +Use escape sequences to represent filter operator characters in a filter value. These escape sequences are separate from any escaping your shell requires. + +| Escape sequence | Represents | +| --------------- | -------------------- | +| `\\` | `\` | +| `\(` | `(` | +| `\)` | `)` | +| `\&` | `&` | +| `\|` | | | +| `\=` | `=` | +| `\!` | `!` | +| `\~` | `~` | + +To escape filter values programmatically, use the `Microsoft.VisualStudio.TestPlatform.ObjectModel.Utilities.FilterHelper.Escape` API from the `Microsoft.VisualStudio.TestPlatform.ObjectModel` NuGet package. + To use an exclamation mark (`!`) in a filter expression, you have to escape it in some Linux or macOS shells by putting a backslash in front of it (`\!`). For example, the following filter skips all tests in a namespace that contains `IntegrationTests`: ```dotnetcli diff --git a/docs/core/tools/dotnet-test-vstest.md b/docs/core/tools/dotnet-test-vstest.md index 765199dddae39..ecfd46d380f24 100644 --- a/docs/core/tools/dotnet-test-vstest.md +++ b/docs/core/tools/dotnet-test-vstest.md @@ -146,6 +146,24 @@ Where `Microsoft.NET.Test.Sdk` is the test host, `xunit` is the test framework. When no unit is used (for example, 5400000), the value is assumed to be in milliseconds. When used together with data driven tests, the timeout behavior depends on the test adapter used. For xUnit, NUnit, and MSTest 2.2.4+, the timeout is renewed after every test case. For MSTest before version 2.2.4, the timeout is used for all test cases. This option is supported on Windows with `netcoreapp2.1` and later, on Linux with `netcoreapp3.1` and later, and on macOS with `net5.0` or later. Implies `--blame` and `--blame-hang`. + You can also configure blame in a `.runsettings` file and pass it with `--settings`. Runsettings configuration supports the same blame behavior and additional keys that aren't exposed as top-level `dotnet test` switches, such as `CollectDumpOnTestSessionHang` and `MonitorPostmortemDebugger`. For more information, see [Blame data collector](https://github.com/microsoft/vstest/blob/main/docs/extensions/blame-datacollector.md). + + ```xml + + + + + + + + + + + + + + ``` + - [!INCLUDE [configuration](includes/cli-configuration.md)] - **`--collect `** From a4c16681a8d343176b6638751872e4c102803a90 Mon Sep 17 00:00:00 2001 From: Azat Mukhametshin Date: Mon, 13 Jul 2026 17:28:08 +0200 Subject: [PATCH 2/8] Link Event Log collector/authoring and env-var reference (T6, T7) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4e840b63-ad95-40c2-9ef8-5f2fcc4cfdaa --- docs/core/tools/dotnet-test-vstest.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/core/tools/dotnet-test-vstest.md b/docs/core/tools/dotnet-test-vstest.md index ecfd46d380f24..f3533efa774e6 100644 --- a/docs/core/tools/dotnet-test-vstest.md +++ b/docs/core/tools/dotnet-test-vstest.md @@ -119,6 +119,8 @@ Where `Microsoft.NET.Test.Sdk` is the test host, `xunit` is the test framework. To collect a crash dump from a native application running on .NET 5.0 or later, the usage of Procdump can be forced by setting the `VSTEST_DUMP_FORCEPROCDUMP` environment variable to `1`. + For the full list of test platform environment variables, see [Environment variables](https://github.com/microsoft/vstest/blob/main/docs/environment-variables.md). + - **`--blame-crash-dump-type `** (Available since .NET 5.0 SDK) The type of crash dump to be collected. Supported dump types are `full` (default), and `mini`. Implies `--blame-crash`. @@ -168,7 +170,7 @@ Where `Microsoft.NET.Test.Sdk` is the test host, `xunit` is the test framework. - **`--collect `** - Enables data collector for the test run. For more information, see [Monitor and analyze test run](https://aka.ms/vstest-collect). + Enables data collector for the test run. For more information, including the Event Log data collector and guidance for authoring your own data collector, see [Monitor and analyze test run](https://aka.ms/vstest-collect). For example you can collect code coverage by using the `--collect "Code Coverage"` option. For more information, see [Use code coverage](/visualstudio/test/using-code-coverage-to-determine-how-much-code-is-being-tested), [Customize code coverage analysis](/visualstudio/test/customizing-code-coverage-analysis), and [GitHub issue dotnet/docs#34479](https://github.com/dotnet/docs/issues/34479). From aa0ee5bdfc24b6e34e338b9f05123057ce9fa316 Mon Sep 17 00:00:00 2001 From: Azat Mukhametshin Date: Wed, 15 Jul 2026 22:59:14 +0200 Subject: [PATCH 3/8] Merge VSTest cross-reference fixes from PR #2 Fold complementary changes from #2 into this PR: --diag tracelevel sub-option, TestRunParameters command-line support with RunSettings precedence, corrected filter property table (xUnit Traits, NUnit TestCategory/Category/Property) with a trait/property mapping note, and the RunSettingsArguments repo link fix. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: c46887ab-e194-4295-9afd-01a25c405c76 --- docs/core/tools/dotnet-test-vstest.md | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/docs/core/tools/dotnet-test-vstest.md b/docs/core/tools/dotnet-test-vstest.md index f3533efa774e6..36c0d51501bcf 100644 --- a/docs/core/tools/dotnet-test-vstest.md +++ b/docs/core/tools/dotnet-test-vstest.md @@ -1,7 +1,7 @@ --- title: dotnet test command with VSTest description: The dotnet test command is used to execute unit tests in a given project using VSTest. -ms.date: 12/29/2024 +ms.date: 07/15/2026 ai-usage: ai-assisted --- # dotnet test with VSTest @@ -180,6 +180,8 @@ Where `Microsoft.NET.Test.Sdk` is the test host, `xunit` is the test framework. Enables diagnostic mode for the test platform and writes diagnostic messages to the specified file and to files next to it. The process that is logging the messages determines which files are created, such as `*.host_.txt` for test host log, and `*.datacollector_.txt` for data collector log. + To set the trace level, append `;tracelevel=` to the log file name, for example `--diag:log.txt;tracelevel=verbose`. The allowed values for `tracelevel` are `off`, `error`, `warning`, `info`, and `verbose`. The default value is `verbose`. + - [!INCLUDE [disable-build-servers](includes/cli-disable-build-servers.md)] - **`-e|--environment `** @@ -274,7 +276,9 @@ Where `Microsoft.NET.Test.Sdk` is the test host, `xunit` is the test framework. Example: `dotnet test -- MSTest.DeploymentEnabled=false MSTest.MapInconclusiveToFailed=True` - For more information, see [Passing RunSettings arguments through command line](https://github.com/Microsoft/vstest-docs/blob/main/docs/RunSettingsArguments.md). + Starting with the .NET 5 SDK, you can also set `TestRunParameters` from the command line, for example: `dotnet test -- TestRunParameters.Parameter(name="myParam", value="value")`. `RunSettings` arguments take precedence over values from a `.runsettings` file. + + For more information, see [Passing RunSettings arguments through command line](https://github.com/microsoft/vstest/blob/main/docs/RunSettingsArguments.md). ## Examples @@ -377,8 +381,10 @@ Where `Microsoft.NET.Test.Sdk` is the test host, `xunit` is the test framework. | Test Framework | Supported properties | | -------------- | --------------------------------------------------------------------------------------------------------- | | MSTest |
  • FullyQualifiedName
  • Name
  • ClassName
  • Priority
  • TestCategory
| -| xUnit |
  • FullyQualifiedName
  • DisplayName
  • Category
| -| NUnit |
  • FullyQualifiedName
  • Name
  • Category
  • Priority
| +| xUnit |
  • FullyQualifiedName
  • DisplayName
  • Traits
| +| NUnit |
  • FullyQualifiedName
  • Name
  • Priority
  • TestCategory
  • Category
  • Property
| + +For xUnit, a trait defined with `[Trait("key", "value")]` is filtered by its key (for example, `[Trait("Category", "bvt")]` is matched with `--filter Category=bvt`). For NUnit, `TestCategory` and `Category` are equivalent, and a property defined with `[Property("key", "value")]` is filtered by its key. The `` describes the relationship between the property and the value: From 482fd87385dcb2022cf31e4b74912c8684d062e1 Mon Sep 17 00:00:00 2001 From: Azat Mukhametshin Date: Sun, 19 Jul 2026 23:17:02 +0200 Subject: [PATCH 4/8] Propagate microsoft/vstest July docs updates and fix archived links Per the propagation plan across the July 13-19 microsoft/vstest docs commits: - Exit codes: add 0/1 contract, no-tests warning behavior, and TreatNoTestsAsError to dotnet-test-vstest.md (copy). - Blame: add option->switch->runsettings mapping tables plus the MTP equivalent to dotnet-test-vstest.md (combination; links vstest for the full reference). - Filter shell escaping: add shell-quoting/PowerShell-comma guidance to selective-unit-tests.md (copy). - CLI selective: update --Platform architecture values in dotnet-vstest.md (x86/x64/ARM/ARM64/S390x/Ppc64le/RiscV64/LoongArch64). Replace both remaining archived Microsoft/vstest-docs filter.md links with microsoft/vstest (verified filter.md exists and covers TestCase filtering). Bump ms.date and add ai-usage disclosure. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: c46887ab-e194-4295-9afd-01a25c405c76 --- docs/core/testing/selective-unit-tests.md | 7 +++-- docs/core/tools/dotnet-test-vstest.md | 35 ++++++++++++++++++++++- docs/core/tools/dotnet-vstest.md | 7 +++-- 3 files changed, 43 insertions(+), 6 deletions(-) diff --git a/docs/core/testing/selective-unit-tests.md b/docs/core/testing/selective-unit-tests.md index 9d329713f857f..d02f4cdfae3f1 100644 --- a/docs/core/testing/selective-unit-tests.md +++ b/docs/core/testing/selective-unit-tests.md @@ -2,7 +2,8 @@ title: Run selected unit tests description: How to use a filter expression to run selected unit tests with the dotnet test command in .NET Core. author: smadala -ms.date: 10/29/2021 +ms.date: 07/19/2026 +ai-usage: ai-assisted zone_pivot_groups: unit-testing-framework-set-one ms.topic: reference --- @@ -71,6 +72,8 @@ For `FullyQualifiedName` values that include a comma for generic type parameters dotnet test --filter "FullyQualifiedName=MyNamespace.MyTestsClass.MyTestMethod" ``` +Because your shell also parses the filter expression, quote the entire `--filter` value whenever it contains characters your shell treats specially, such as `<`, `>`, or `,`. Quoting is required in PowerShell, where the comma is the array operator. + For `Name` or `DisplayName`, use the URL encoding for the special characters. For example, to run a test with the name `MyTestMethod` and a string value `"text"`, use the following filter: ```dotnetcli @@ -243,7 +246,7 @@ To run tests that have either a ``` + The following tables map the blame options to their `dotnet test` switches and `.runsettings` elements. For the complete blame collector reference, see [Blame data collector](https://github.com/microsoft/vstest/blob/main/docs/extensions/blame-datacollector.md). + + Crash dump options: + + | Behavior | `dotnet test` switch | `.runsettings` element | + | --- | --- | --- | + | Collect a crash dump | `--blame-crash` | `` | + | Collect even on a clean exit | `--blame-crash-collect-always` | `` | + | Dump type (`mini`, `full`; default `full`) | `--blame-crash-dump-type` | `` | + + Hang dump options: + + | Behavior | `dotnet test` switch | `.runsettings` element | + | --- | --- | --- | + | Collect a hang dump | `--blame-hang` | `` | + | Timeout before the hang dump (default `1h`) | `--blame-hang-timeout` | `` | + | Hang dump type (`mini`, `full`, `none`) | `--blame-hang-dump-type` | `` | + + For Microsoft.Testing.Platform (MTP) test apps, the `--blame-*` switches and the blame data collector don't apply. MTP uses `--crashdump`, `--hangdump`, and `--hangdump-timeout` from the `Microsoft.Testing.Extensions.CrashDump` and `Microsoft.Testing.Extensions.HangDump` packages. For more information, see [dotnet test with MTP](dotnet-test-mtp.md). + - [!INCLUDE [configuration](includes/cli-configuration.md)] - **`--collect `** @@ -410,6 +430,19 @@ You can enclose expressions in parenthesis when using conditional operators (for For more information and examples on how to use selective unit test filtering, see [Running selective unit tests](../testing/selective-unit-tests.md). +## Exit codes + +When you run tests through the VSTest path, `dotnet test` reports the outcome with one of two exit codes: + +| Exit code | Meaning | +| --------- | ------- | +| `0` | Success. The requested operation completed and, for a test run, all executed tests passed. | +| `1` | Failure. For example, one or more tests failed, a run error was reported, the command line was invalid, a test source couldn't be loaded, or the run was aborted or canceled. | + +The underlying `vstest.console` process never returns any other value. + +When discovery finds no matching tests, the run prints a warning rather than an error and still returns `0` by default. To make a run that discovers or selects zero tests return `1` instead, set `RunConfiguration.TreatNoTestsAsError` to `true` in a `.runsettings` file. + ## See also - [Frameworks and Targets](../../standard/frameworks.md) diff --git a/docs/core/tools/dotnet-vstest.md b/docs/core/tools/dotnet-vstest.md index 1a29ffb81e98b..9c4613a7b2f22 100644 --- a/docs/core/tools/dotnet-vstest.md +++ b/docs/core/tools/dotnet-vstest.md @@ -1,7 +1,8 @@ --- title: dotnet vstest command description: The dotnet vstest command builds a project and all of its dependencies. -ms.date: 10/28/2025 +ms.date: 07/19/2026 +ai-usage: ai-assisted --- # dotnet vstest @@ -92,7 +93,7 @@ The `dotnet vstest` command runs the `VSTest.Console` command-line application t - **`--Platform `** - Target platform architecture used for test execution. Valid values are `x86`, `x64`, and `ARM`. + Target platform architecture used for test execution. Valid values are `x86`, `x64`, `ARM`, `ARM64`, `S390x`, `Ppc64le`, `RiscV64`, and `LoongArch64`. - **`--Port `** @@ -112,7 +113,7 @@ The `dotnet vstest` command runs the `VSTest.Console` command-line application t - **`--TestCaseFilter `** - Run tests that match the given expression. `` is of the format `Operator[|&]`, where Operator is one of `=`, `!=`, or `~`. Operator `~` has 'contains' semantics and is applicable for string properties like `DisplayName`. Parentheses `()` are used to group subexpressions. For more information, see [TestCase filter](https://github.com/Microsoft/vstest-docs/blob/main/docs/filter.md). + Run tests that match the given expression. `` is of the format `Operator[|&]`, where Operator is one of `=`, `!=`, or `~`. Operator `~` has 'contains' semantics and is applicable for string properties like `DisplayName`. Parentheses `()` are used to group subexpressions. For more information, see [TestCase filter](https://github.com/microsoft/vstest/blob/main/docs/filter.md). - **`--Tests `** From f7355c17a9b38d2e46a5b6997ae7f08fa070f803 Mon Sep 17 00:00:00 2001 From: Azat Mukhametshin Date: Sun, 19 Jul 2026 23:35:00 +0200 Subject: [PATCH 5/8] Align dotnet vstest options with vstest.console reference - Add the missing user-facing options --Collect and -e|--Environment (both are forwarded to vstest.console and documented in vstest's main CLI reference). - Remove --Port and --ParentProcessId, which vstest classifies as editor/IDE (design-mode) integration options not intended for direct shell use. - Fix Synopsis formatting for --Platform and --ResultsDirectory, and note that options are forwarded to vstest.console with a link to the full commandline.md reference. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: c46887ab-e194-4295-9afd-01a25c405c76 --- docs/core/tools/dotnet-vstest.md | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/docs/core/tools/dotnet-vstest.md b/docs/core/tools/dotnet-vstest.md index 9c4613a7b2f22..c6b8585a2f9c6 100644 --- a/docs/core/tools/dotnet-vstest.md +++ b/docs/core/tools/dotnet-vstest.md @@ -18,20 +18,20 @@ ai-usage: ai-assisted ## Synopsis ```dotnetcli -dotnet vstest [] [--Blame] [--Diag ] +dotnet vstest [] [--Blame] [--Collect ] + [--Diag ] [-e|--Environment =""] [--Framework ] [--InIsolation] [-lt|--ListTests ] [--logger ] [--Parallel] - [--ParentProcessId ] [--Platform] - [--Port ] [--ResultsDirectory] [--Settings ] - [--TestAdapterPath ] [--TestCaseFilter ] - [--Tests ] [[--] ...] + [--Platform ] [--ResultsDirectory ] + [--Settings ] [--TestAdapterPath ] + [--TestCaseFilter ] [--Tests ] [[--] ...] dotnet vstest -?|--Help ``` ## Description -The `dotnet vstest` command runs the `VSTest.Console` command-line application to run automated unit tests. +The `dotnet vstest` command runs the `VSTest.Console` command-line application to run automated unit tests. The options in this article are forwarded to `vstest.console`. For the complete list of command-line options, see [vstest.console.exe command line options](https://github.com/microsoft/vstest/blob/main/docs/commandline.md). ## Arguments @@ -45,10 +45,18 @@ The `dotnet vstest` command runs the `VSTest.Console` command-line application t Runs the tests in blame mode. This option is helpful in isolating the problematic tests causing test host to crash. It creates an output file in the current directory as *Sequence.xml* that captures the order of tests execution before the crash. +- **`--Collect `** + + Enables a data collector for the test run. For example, `--Collect "Code Coverage"` collects code coverage with the built-in Visual Studio collector, and `--Collect "XPlat Code Coverage"` uses the cross-platform Coverlet collector. For more information, see [Monitor and analyze test run](https://aka.ms/vstest-collect). + - **`--Diag `** Enables verbose logs for the test platform. Logs are written to the provided file. +- **`-e|--Environment =""`** + + Sets the value of an environment variable for the test host process. Creates the variable if it doesn't exist, overrides it if it does. Using this option forces the tests to run in an isolated process. Specify the option multiple times to set multiple variables. + - **`--Framework `** Target .NET Framework version used for test execution. An example of a valid value is `.NETFramework,Version=v7.0`. Other supported values are `Framework40`, `Framework45`, `FrameworkCore10`, and `FrameworkUap10`. @@ -87,18 +95,10 @@ The `dotnet vstest` command runs the `VSTest.Console` command-line application t Run tests in parallel. By default, all available cores on the machine are available for use. Specify an explicit number of cores by setting the `MaxCpuCount` property under the `RunConfiguration` node in the *runsettings* file. -- **`--ParentProcessId `** - - Process ID of the parent process responsible for launching the current process. - - **`--Platform `** Target platform architecture used for test execution. Valid values are `x86`, `x64`, `ARM`, `ARM64`, `S390x`, `Ppc64le`, `RiscV64`, and `LoongArch64`. -- **`--Port `** - - Specifies the port for the socket connection and receiving the event messages. - - **`--ResultsDirectory:`** Test results directory will be created in specified path if not exists. @@ -166,3 +166,4 @@ dotnet vstest /Tests:TestMethod1,TestMethod2 ## See also - [VSTest.Console.exe command-line options](/visualstudio/test/vstest-console-options) +- [vstest.console.exe command line options (microsoft/vstest)](https://github.com/microsoft/vstest/blob/main/docs/commandline.md) From 8823d417fbe9e747fb185840c62c84ede1421b74 Mon Sep 17 00:00:00 2001 From: Azat Mukhametshin Date: Sun, 19 Jul 2026 23:43:05 +0200 Subject: [PATCH 6/8] Clarify the two vstest.console option references in See also Annotate the Learn and microsoft/vstest command-line option links so a reader can tell which to use: Learn for stable curated docs, the vstest repo for the most current/source-derived details. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: c46887ab-e194-4295-9afd-01a25c405c76 --- docs/core/tools/dotnet-vstest.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/core/tools/dotnet-vstest.md b/docs/core/tools/dotnet-vstest.md index c6b8585a2f9c6..356b1b9039630 100644 --- a/docs/core/tools/dotnet-vstest.md +++ b/docs/core/tools/dotnet-vstest.md @@ -165,5 +165,5 @@ dotnet vstest /Tests:TestMethod1,TestMethod2 ## See also -- [VSTest.Console.exe command-line options](/visualstudio/test/vstest-console-options) -- [vstest.console.exe command line options (microsoft/vstest)](https://github.com/microsoft/vstest/blob/main/docs/commandline.md) +- [VSTest.Console.exe command-line options](/visualstudio/test/vstest-console-options) - the official Microsoft Learn reference for the `VSTest.Console.exe` tool, including options that `dotnet vstest` doesn't expose. Start here for stable, curated documentation. +- [vstest.console.exe command line options (microsoft/vstest)](https://github.com/microsoft/vstest/blob/main/docs/commandline.md) - the source-derived reference in the `microsoft/vstest` repo. Use it for the most up-to-date option details and internal switches, plus links to related runsettings, filtering, and diagnostics docs. From 039f23606937edf4fb35d060254bbbff46e24f62 Mon Sep 17 00:00:00 2001 From: Azat Mukhametshin Date: Sun, 19 Jul 2026 23:53:37 +0200 Subject: [PATCH 7/8] Add VSTest environment variables link to See also in both articles Link microsoft/vstest docs/environment-variables.md from the See also section of dotnet-test-vstest.md and dotnet-vstest.md so readers can find the full VSTest env-var reference (including the VSTEST_DOTNET_ROOT_* variables the SDK sets when launching vstest.console). Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: c46887ab-e194-4295-9afd-01a25c405c76 --- docs/core/tools/dotnet-test-vstest.md | 1 + docs/core/tools/dotnet-vstest.md | 1 + 2 files changed, 2 insertions(+) diff --git a/docs/core/tools/dotnet-test-vstest.md b/docs/core/tools/dotnet-test-vstest.md index acfe2853a7d54..390282d12fe27 100644 --- a/docs/core/tools/dotnet-test-vstest.md +++ b/docs/core/tools/dotnet-test-vstest.md @@ -448,5 +448,6 @@ When discovery finds no matching tests, the run prints a warning rather than an - [Frameworks and Targets](../../standard/frameworks.md) - [.NET Runtime Identifier (RID) catalog](../rid-catalog.md) - [Passing runsettings arguments through commandline](https://github.com/microsoft/vstest/blob/main/docs/RunSettingsArguments.md) +- [VSTest environment variables (microsoft/vstest)](https://github.com/microsoft/vstest/blob/main/docs/environment-variables.md) - [dotnet test](dotnet-test.md) - [dotnet test with MTP](dotnet-test-mtp.md) diff --git a/docs/core/tools/dotnet-vstest.md b/docs/core/tools/dotnet-vstest.md index 356b1b9039630..3122d9e3200b9 100644 --- a/docs/core/tools/dotnet-vstest.md +++ b/docs/core/tools/dotnet-vstest.md @@ -167,3 +167,4 @@ dotnet vstest /Tests:TestMethod1,TestMethod2 - [VSTest.Console.exe command-line options](/visualstudio/test/vstest-console-options) - the official Microsoft Learn reference for the `VSTest.Console.exe` tool, including options that `dotnet vstest` doesn't expose. Start here for stable, curated documentation. - [vstest.console.exe command line options (microsoft/vstest)](https://github.com/microsoft/vstest/blob/main/docs/commandline.md) - the source-derived reference in the `microsoft/vstest` repo. Use it for the most up-to-date option details and internal switches, plus links to related runsettings, filtering, and diagnostics docs. +- [VSTest environment variables (microsoft/vstest)](https://github.com/microsoft/vstest/blob/main/docs/environment-variables.md) - environment variables that VSTest and the test host recognize, such as `VSTEST_DUMP_FORCEPROCDUMP` and the `VSTEST_DOTNET_ROOT_*` variables the .NET SDK sets when it launches `vstest.console`. From 6c85f8aa2721ae5eac9520b4693700570adc1c58 Mon Sep 17 00:00:00 2001 From: Azat Mukhametshin Date: Mon, 20 Jul 2026 00:06:38 +0200 Subject: [PATCH 8/8] Address automated review feedback on VSTest docs dotnet-vstest.md: use the standard NAME/VALUE placeholder form for --Environment; align --ResultsDirectory to the space form used by the synopsis and other options. dotnet-test-vstest.md: reword to 'The .runsettings file'; lowercase the blame example dump-type values to match the mapping tables and switch values; 'Enables a data collector'; use the space-form --diag in the tracelevel example. selective-unit-tests.md: capitalize NUnit. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: c46887ab-e194-4295-9afd-01a25c405c76 --- docs/core/testing/selective-unit-tests.md | 2 +- docs/core/tools/dotnet-test-vstest.md | 10 +++++----- docs/core/tools/dotnet-vstest.md | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/core/testing/selective-unit-tests.md b/docs/core/testing/selective-unit-tests.md index d02f4cdfae3f1..8f6dd5633b163 100644 --- a/docs/core/testing/selective-unit-tests.md +++ b/docs/core/testing/selective-unit-tests.md @@ -32,7 +32,7 @@ dotnet test --filter | -------------- | -------------------- | | MSTest | `FullyQualifiedName`
`Name`
`ClassName`
`Priority`
`TestCategory` | | xUnit | `FullyQualifiedName`
`DisplayName`
`Traits` | - | Nunit | `FullyQualifiedName`
`Name`
`Priority`
`TestCategory`
`Category`
`Property` | + | NUnit | `FullyQualifiedName`
`Name`
`Priority`
`TestCategory`
`Category`
`Property` | * **Operators** diff --git a/docs/core/tools/dotnet-test-vstest.md b/docs/core/tools/dotnet-test-vstest.md index 390282d12fe27..faa827206adbe 100644 --- a/docs/core/tools/dotnet-test-vstest.md +++ b/docs/core/tools/dotnet-test-vstest.md @@ -148,7 +148,7 @@ Where `Microsoft.NET.Test.Sdk` is the test host, `xunit` is the test framework. When no unit is used (for example, 5400000), the value is assumed to be in milliseconds. When used together with data driven tests, the timeout behavior depends on the test adapter used. For xUnit, NUnit, and MSTest 2.2.4+, the timeout is renewed after every test case. For MSTest before version 2.2.4, the timeout is used for all test cases. This option is supported on Windows with `netcoreapp2.1` and later, on Linux with `netcoreapp3.1` and later, and on macOS with `net5.0` or later. Implies `--blame` and `--blame-hang`. - You can also configure blame in a `.runsettings` file and pass it with `--settings`. Runsettings configuration supports the same blame behavior and additional keys that aren't exposed as top-level `dotnet test` switches, such as `CollectDumpOnTestSessionHang` and `MonitorPostmortemDebugger`. For more information, see [Blame data collector](https://github.com/microsoft/vstest/blob/main/docs/extensions/blame-datacollector.md). + You can also configure blame in a `.runsettings` file and pass it with `--settings`. The `.runsettings` file supports the same blame behavior and additional keys that aren't exposed as top-level `dotnet test` switches, such as `CollectDumpOnTestSessionHang` and `MonitorPostmortemDebugger`. For more information, see [Blame data collector](https://github.com/microsoft/vstest/blob/main/docs/extensions/blame-datacollector.md). ```xml @@ -156,8 +156,8 @@ Where `Microsoft.NET.Test.Sdk` is the test host, `xunit` is the test framework. - - + + @@ -190,7 +190,7 @@ Where `Microsoft.NET.Test.Sdk` is the test host, `xunit` is the test framework. - **`--collect `** - Enables data collector for the test run. For more information, including the Event Log data collector and guidance for authoring your own data collector, see [Monitor and analyze test run](https://aka.ms/vstest-collect). + Enables a data collector for the test run. For more information, including the Event Log data collector and guidance for authoring your own data collector, see [Monitor and analyze test run](https://aka.ms/vstest-collect). For example you can collect code coverage by using the `--collect "Code Coverage"` option. For more information, see [Use code coverage](/visualstudio/test/using-code-coverage-to-determine-how-much-code-is-being-tested), [Customize code coverage analysis](/visualstudio/test/customizing-code-coverage-analysis), and [GitHub issue dotnet/docs#34479](https://github.com/dotnet/docs/issues/34479). @@ -200,7 +200,7 @@ Where `Microsoft.NET.Test.Sdk` is the test host, `xunit` is the test framework. Enables diagnostic mode for the test platform and writes diagnostic messages to the specified file and to files next to it. The process that is logging the messages determines which files are created, such as `*.host_.txt` for test host log, and `*.datacollector_.txt` for data collector log. - To set the trace level, append `;tracelevel=` to the log file name, for example `--diag:log.txt;tracelevel=verbose`. The allowed values for `tracelevel` are `off`, `error`, `warning`, `info`, and `verbose`. The default value is `verbose`. + To set the trace level, append `;tracelevel=` to the log file name, for example `--diag log.txt;tracelevel=verbose`. The allowed values for `tracelevel` are `off`, `error`, `warning`, `info`, and `verbose`. The default value is `verbose`. - [!INCLUDE [disable-build-servers](includes/cli-disable-build-servers.md)] diff --git a/docs/core/tools/dotnet-vstest.md b/docs/core/tools/dotnet-vstest.md index 3122d9e3200b9..a9b1ec04f04f5 100644 --- a/docs/core/tools/dotnet-vstest.md +++ b/docs/core/tools/dotnet-vstest.md @@ -19,7 +19,7 @@ ai-usage: ai-assisted ```dotnetcli dotnet vstest [] [--Blame] [--Collect ] - [--Diag ] [-e|--Environment =""] + [--Diag ] [-e|--Environment ] [--Framework ] [--InIsolation] [-lt|--ListTests ] [--logger ] [--Parallel] [--Platform ] [--ResultsDirectory ] @@ -53,7 +53,7 @@ The `dotnet vstest` command runs the `VSTest.Console` command-line application t Enables verbose logs for the test platform. Logs are written to the provided file. -- **`-e|--Environment =""`** +- **`-e|--Environment `** Sets the value of an environment variable for the test host process. Creates the variable if it doesn't exist, overrides it if it does. Using this option forces the tests to run in an isolated process. Specify the option multiple times to set multiple variables. @@ -99,7 +99,7 @@ The `dotnet vstest` command runs the `VSTest.Console` command-line application t Target platform architecture used for test execution. Valid values are `x86`, `x64`, `ARM`, `ARM64`, `S390x`, `Ppc64le`, `RiscV64`, and `LoongArch64`. -- **`--ResultsDirectory:`** +- **`--ResultsDirectory `** Test results directory will be created in specified path if not exists.