Skip to content

Commit

Permalink
dotnet test CLI ref updates (#18209)
Browse files Browse the repository at this point in the history
* codecoverage

* add example

* remove dup example

* nunit examples

* Update docs/core/tools/dotnet-test.md

Co-authored-by: Jakub Jareš <[email protected]>

Co-authored-by: Jakub Jareš <[email protected]>
  • Loading branch information
tdykstra and nohwnd authored May 26, 2020
1 parent e3c0fd5 commit 7a64cd9
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions docs/core/tools/dotnet-test.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ Where `Microsoft.NET.Test.Sdk` is the test host, `xunit` is the test framework.
- **`--collect <DATA_COLLECTOR_FRIENDLY_NAME>`**

Enables data collector for the test run. For more information, see [Monitor and analyze test run](https://aka.ms/vstest-collect).

To collect code coverage on any platform that is supported by .NET Core, install [Coverlet](https://github.com/coverlet-coverage/coverlet/blob/master/README.md) and use the `--collect:"XPlat Code Coverage"` option.

On Windows, you can collect code coverage by using the `--collect "Code Coverage"` option. This option generates a *.coverage* file, which can be opened in Visual Studio 2019 Enterprise. For more information, see [Use code coverage](/visualstudio/test/using-code-coverage-to-determine-how-much-code-is-being-tested) and [Customize code coverage analysis](/visualstudio/test/customizing-code-coverage-analysis).

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

Expand Down Expand Up @@ -165,6 +169,18 @@ Where `Microsoft.NET.Test.Sdk` is the test host, `xunit` is the test framework.
dotnet test --logger trx
```

- Run the tests in the project in the current directory, and generate a code coverage file (after installing [Coverlet](https://github.com/tonerdo/coverlet/blob/master/README.md)):

```dotnetcli
dotnet test --collect:"XPlat Code Coverage"
```

- Run the tests in the project in the current directory, and generate a code coverage file (Windows only):

```dotnetcli
dotnet test --collect "Code Coverage"
```

- Run the tests in the project in the current directory, and log with detailed verbosity to the console:

```dotnetcli
Expand All @@ -189,6 +205,7 @@ Where `Microsoft.NET.Test.Sdk` is the test host, `xunit` is the test framework.
| -------------- | --------------------------------------------------------------------------------------------------------- |
| MSTest | <ul><li>FullyQualifiedName</li><li>Name</li><li>ClassName</li><li>Priority</li><li>TestCategory</li></ul> |
| xUnit | <ul><li>FullyQualifiedName</li><li>DisplayName</li><li>Traits</li></ul> |
| NUnit | <ul><li>FullyQualifiedName</li><li>Name</li><li>TestCategory</li><li>Priority</li></ul> |

The `<operator>` describes the relationship between the property and the value:

Expand Down

0 comments on commit 7a64cd9

Please sign in to comment.