diff --git a/docs/core/tools/dotnet-test.md b/docs/core/tools/dotnet-test.md index 0ad88f9811c6d..373f4b00a0e1a 100644 --- a/docs/core/tools/dotnet-test.md +++ b/docs/core/tools/dotnet-test.md @@ -73,6 +73,10 @@ 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). + + 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 `** @@ -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 @@ -189,6 +205,7 @@ Where `Microsoft.NET.Test.Sdk` is the test host, `xunit` is the test framework. | -------------- | --------------------------------------------------------------------------------------------------------- | | MSTest | | | xUnit | | +| NUnit | | The `` describes the relationship between the property and the value: