Skip to content

Commit c700e7d

Browse files
nohwndtdykstra
andauthored
Update parameters with recent changes (#18295)
* Update parameters with recent changes * Fix lint * Update docs/core/tools/dotnet-test.md Co-authored-by: Tom Dykstra <[email protected]> * Update docs/core/tools/dotnet-test.md Co-authored-by: Tom Dykstra <[email protected]> * Update docs/core/tools/dotnet-test.md Co-authored-by: Tom Dykstra <[email protected]> * Update docs/core/tools/dotnet-test.md Co-authored-by: Tom Dykstra <[email protected]> * Update docs/core/tools/dotnet-test.md Co-authored-by: Tom Dykstra <[email protected]> * Update docs/core/tools/dotnet-test.md Co-authored-by: Tom Dykstra <[email protected]> * Update docs/core/tools/dotnet-test.md Co-authored-by: Tom Dykstra <[email protected]> * Update docs/core/tools/dotnet-test.md Co-authored-by: Tom Dykstra <[email protected]> * markdownlint fix Co-authored-by: Tom Dykstra <[email protected]>
1 parent 195f891 commit c700e7d

File tree

1 file changed

+25
-10
lines changed

1 file changed

+25
-10
lines changed

docs/core/tools/dotnet-test.md

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ ms.date: 04/29/2020
1414
## Synopsis
1515

1616
```dotnetcli
17-
dotnet test [<PROJECT> | <SOLUTION>]
17+
dotnet test [<PROJECT> | <SOLUTION> | <DIRECTORY> | <DLL>]
1818
[-a|--test-adapter-path <PATH_TO_ADAPTER>] [--blame]
1919
[-c|--configuration <CONFIGURATION>]
2020
[--collect <DATA_COLLECTOR_FRIENDLY_NAME>]
@@ -31,31 +31,40 @@ dotnet test -h|--help
3131

3232
## Description
3333

34-
The `dotnet test` command is used to execute unit tests in a given project. The `dotnet test` command launches the test runner console application specified for a project. The test runner executes the tests defined for a unit test framework (for example, MSTest, NUnit, or xUnit) and reports the success or failure of each test. If all tests are successful, the test runner returns 0 as an exit code; otherwise if any test fails, it returns 1. For multi-targeted projects, tests are run for each targeted framework. The test runner and the unit test library are packaged as NuGet packages and are restored as ordinary dependencies for the project.
34+
The `dotnet test` command is used to execute unit tests in a given solution. The `dotnet test` command builds the solution and runs a test host application for each test project in the solution. The test host executes tests in the given project using a test framework, for example: MSTest, NUnit, or xUnit, and reports the success or failure of each test. If all tests are successful, the test runner returns 0 as an exit code; otherwise if any test fails, it returns 1.
35+
36+
For multi-targeted projects, tests are run for each targeted framework. The test host and the unit test framework are packaged as NuGet packages and are restored as ordinary dependencies for the project.
3537

3638
Test projects specify the test runner using an ordinary `<PackageReference>` element, as seen in the following sample project file:
3739

3840
[!code-xml[XUnit Basic Template](../../../samples/snippets/csharp/xunit-test/xunit-test.csproj)]
3941

42+
Where `Microsoft.NET.Test.Sdk` is the test host, `xunit` is the test framework. And `xunit.runner.visualstudio` is a test adapter, which allows the xUnit framework to work with the test host.
43+
4044
### Implicit restore
4145

4246
[!INCLUDE[dotnet restore note](~/includes/dotnet-restore-note.md)]
4347

4448
## Arguments
4549

46-
- **`PROJECT | SOLUTION`**
50+
- **`PROJECT | SOLUTION | DIRECTORY | DLL`**
51+
52+
- Path to the test project.
53+
- Path to the solution.
54+
- Path to a directory that contains a project or a solution.
55+
- Path to a test project *.dll* file.
4756

48-
Path to the test project or solution. If not specified, it defaults to current directory.
57+
If not specified, it searches for a project or a solution in the current directory.
4958

5059
## Options
5160

5261
- **`-a|--test-adapter-path <PATH_TO_ADAPTER>`**
5362

54-
Use the custom test adapters from the specified path in the test run.
63+
Path to a directory to be searched for additional test adapters. Only *.dll* files with suffix `.TestAdapter.dll` are inspected. If not specified, the directory of the test *.dll* is searched.
5564

5665
- **`--blame`**
5766

58-
Runs the tests in blame mode. This option is helpful in isolating problematic tests that cause the 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.
67+
Runs the tests in blame mode. This option is helpful in isolating problematic tests that cause the test host to crash. When a crash is detected, it creates an sequence file in `TestResults/<Guid>/<Guid>_Sequence.xml` that captures the order of tests that were run before the crash.
5968

6069
- **`-c|--configuration <CONFIGURATION>`**
6170

@@ -67,11 +76,11 @@ Test projects specify the test runner using an ordinary `<PackageReference>` ele
6776

6877
- **`-d|--diag <PATH_TO_DIAGNOSTICS_FILE>`**
6978

70-
Enables diagnostic mode for the test platform and writes diagnostic messages to the specified file.
79+
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_<date>.txt` for test host log, and `*.datacollector_<date>.txt` for data collector log.
7180

7281
- **`-f|--framework <FRAMEWORK>`**
7382

74-
Looks for test binaries for a specific [framework](../../standard/frameworks.md).
83+
Forces the use of `dotnet` or .NET Framework test host for the test binaries. This option only determines which type of host to use. The actual framework version to be used is determined by the *runtimeconfig.json* of the test project. When not specified, the [TargetFramework assembly attribute](/dotnet/api/system.runtime.versioning.targetframeworkattribute) is used to determine the type of host. When that attribute is stripped from the *.dll*, the .NET Framework host is used.
7584

7685
- **`--filter <EXPRESSION>`**
7786

@@ -115,7 +124,7 @@ Test projects specify the test runner using an ordinary `<PackageReference>` ele
115124

116125
- **`-s|--settings <SETTINGS_FILE>`**
117126

118-
The `.runsettings` file to use for running the tests. Note that the `TargetPlatform` element (x86|x64) has no effect for `dotnet test`. To run tests that target x86, install the x86 version of .NET Core. The bitness of the *dotnet.exe* that is on the path is what will be used for running tests. for more information, see the following resources:
127+
The `.runsettings` file to use for running the tests. Note that the `TargetPlatform` element (x86|x64) has no effect for `dotnet test`. To run tests that target x86, install the x86 version of .NET Core. The bitness of the *dotnet.exe* that is on the path is what will be used for running tests. For more information, see the following resources:
119128

120129
- [Configure unit tests by using a `.runsettings` file.](/visualstudio/test/configure-unit-tests-by-using-a-dot-runsettings-file)
121130
- [Configure a test run](https://github.com/Microsoft/vstest-docs/blob/master/docs/configure.md)
@@ -130,7 +139,7 @@ Test projects specify the test runner using an ordinary `<PackageReference>` ele
130139

131140
- **`RunSettings`** arguments
132141

133-
Arguments are passed as `RunSettings` configurations for the test. Arguments are specified as `[name]=[value]` pairs after "-- " (note the space after --). A space is used to separate multiple `[name]=[value]` pairs.
142+
Inline `RunSettings` are passed as the last arguments on the command line after "-- " (note the space after --). Inline `RunSettings` are specified as `[name]=[value]` pairs. A space is used to separate multiple `[name]=[value]` pairs.
134143

135144
Example: `dotnet test -- MSTest.DeploymentEnabled=false MSTest.MapInconclusiveToFailed=True`
136145

@@ -161,6 +170,12 @@ Test projects specify the test runner using an ordinary `<PackageReference>` ele
161170
```dotnetcli
162171
dotnet test --logger "console;verbosity=detailed"
163172
```
173+
174+
- Run the tests in the project in the current directory, and report tests that were in progress when the test host crashed:
175+
176+
```dotnetcli
177+
dotnet test --blame
178+
```
164179

165180
## Filter option details
166181

0 commit comments

Comments
 (0)