Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dotnet-test docs #45357

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
20 changes: 12 additions & 8 deletions docs/core/tools/dotnet-test.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Some examples of the `dotnet.config` file:
name = "VSTest"
```

## VSTest and Microsoft Testing Platform (MTP)
## VSTest and Microsoft.Testing.Platform (MTP)

### [dotnet test with VSTest](#tab/dotnet-test-with-vstest)

Expand Down Expand Up @@ -441,14 +441,18 @@ dotnet test -h|--help
With Microsoft Testing Platform, `dotnet test` operates faster than with VSTest. The test-related arguments are no longer fixed, as they are tied to the registered extensions in the test project(s). Moreover, MTP supports a globbing filter when running tests. For more information, see [Microsoft.Testing.Platform](../testing/microsoft-testing-platform-intro.md).

> [!WARNING]
> `dotnet test` doesn't run in environments that have test projects using both VSTest and Microsoft Testing Platform in the same solution, as the two platforms are mutually incompatible.
> When opting-in Microsoft.Testing.Platform via `dotnet.config`, `dotnet test` expects all test projects to use Microsoft.Testing.Platform. It is an error if any of the test project uses VSTest.

#### Implicit restore

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

#### Options

> [!NOTE]
> You can use only one of the following options at a time: `--project`, `--solution`, `--directory`, or `--test-modules`. These options can't be combined.
> In addition, when using `--test-modules`, you cannot specify `--arch`, `--configuration`, `--framework`, `--os`, or `--runtime`. These options are not relevant for an already-built module.
Comment on lines +452 to +454
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is WIP in dotnet/sdk#47616. @rainersigwald @baronfel I need a bit of confirmation on the behavior before merging this docs PR please.


- **`--project <PROJECT_PATH>`**

Specifies the path to the test project.
Expand All @@ -461,9 +465,6 @@ With Microsoft Testing Platform, `dotnet test` operates faster than with VSTest.

Specifies the path to a directory that contains a project or a solution.

> [!NOTE]
> You can use only one of the following options at a time: `--project`, `--solution`, or `--directory`. These options can't be combined.

- **`--test-modules <EXPRESSION>`**

Filters test modules using file globbing in .NET. Only tests belonging to those test modules will run. For more information and examples on how to use file globbing in .NET, see [File globbing](../../../docs/core/extensions/file-globbing.md).
Expand Down Expand Up @@ -533,14 +534,17 @@ With Microsoft Testing Platform, `dotnet test` operates faster than with VSTest.

- **`args`**

Specifies extra arguments to pass to the test application(s). Use a space to separate multiple arguments. For more information and examples on what to pass, see [Microsoft Testing Platform](../../../docs/core/testing/microsoft-testing-platform-intro.md) and [Microsoft.Testing.Platform extensions](../../../docs/core/testing/microsoft-testing-platform-extensions.md).
Specifies extra arguments to pass to the test application(s). Use a space to separate multiple arguments. For more information and examples on what to pass, see [Microsoft.Testing.Platform overview](../../../docs/core/testing/microsoft-testing-platform-intro.md) and [Microsoft.Testing.Platform extensions](../../../docs/core/testing/microsoft-testing-platform-extensions.md).

> [!TIP]
> To specify extra arguments for specific project(s), use `TestingPlatformCommandLineArguments` MSBuild property.

> [!NOTE]
> To enable trace logging to a file, use the environment variable `DOTNET_CLI_TEST_TRACEFILE` to provide the path to the trace file.

#### Examples

- Run the tests in the project in the current directory:
- Run the tests in the project or solution in the current directory:

```dotnetcli
dotnet test
Expand All @@ -558,7 +562,7 @@ With Microsoft Testing Platform, `dotnet test` operates faster than with VSTest.
dotnet test --solution ./TestProjects/TestProjects.sln
```

- Run the tests in the `TestProjects` directory:
- Run the tests in a solution or project that can be found in the `TestProjects` directory:

```dotnetcli
dotnet test --directory ./TestProjects
Expand Down
Loading