diff --git a/docs/core/additional-tools/dotnet-coverage.md b/docs/core/additional-tools/dotnet-coverage.md index c7c478f5b8e73..2c1c765f4ba0d 100644 --- a/docs/core/additional-tools/dotnet-coverage.md +++ b/docs/core/additional-tools/dotnet-coverage.md @@ -11,7 +11,7 @@ ms.topic: reference ## Synopsis ```console -dotnet-coverage [-h, --help] [--version] +dotnet-coverage [-h, --help] [--version] ``` ## Description @@ -49,6 +49,7 @@ dotnet tool install --global dotnet-coverage | [dotnet-coverage snapshot](#dotnet-coverage-snapshot) | | [dotnet-coverage shutdown](#dotnet-coverage-shutdown) | | [dotnet-coverage instrument](#dotnet-coverage-instrument) | +| [dotnet-coverage uninstrument](#dotnet-coverage-uninstrument) | ## dotnet-coverage merge @@ -62,10 +63,12 @@ The `merge` command is used to merge several code coverage reports into one. Thi ```console dotnet-coverage merge + ... [--remove-input-files] [-o|--output ] [-f|--output-format ] - [-l|--log-file ] [-ll|--log-level ] [-?|-h|--help] - + [-l|--log-file ] [-ll|--log-level ] + [-dco|--disable-console-output] [--nologo] + [-?|-h|--help] ``` ### Arguments @@ -100,6 +103,14 @@ dotnet-coverage merge Sets the log level. Supported values: `Error`, `Info`, and `Verbose`. +* **`-dco|--disable-console-output`** + + Disables console output. + +* **`--nologo`** + + Do not display Code Coverage banner. + ## dotnet-coverage collect The `collect` command is used to collect code coverage data for any .NET process and its subprocesses. For example, you can collect code coverage data for a console application or a Blazor application. This command supports dynamic and static instrumentation. Static instrumentation is available on all platforms. You can specify files to be statically instrumented using `include-files` option. Dynamic instrumentation is available on Windows (x86, x64 and Arm64), Linux (x64), and macOS (x64). The command supports only .NET modules. Native modules are not supported. @@ -114,11 +125,12 @@ The `collect` command will collect code coverage for the given process executed ```console dotnet-coverage collect + ... [-s|--settings ] [-id|--session-id ] - [-if|--include-files ] [-o|--output ] - [-f|--output-format ] [-l|--log-file ] - [-ll|--log-level ] [-?|-h|--help] - + [-if|--include-files ] [-o|--output ] [-f|--output-format ] + [-l|--log-file ] [-ll|--log-level ] + [-dco|--disable-console-output] [--nologo] + [-?|-h|--help] ``` #### Server Mode @@ -129,9 +141,10 @@ The `collect` command hosts a server for code coverage collection. Clients can c dotnet-coverage collect [-s|--settings ] [-id|--session-id ] [-sv|--server-mode] [-b|--background] [-t|--timeout] - [-if|--include-files ] [-o|--output ] - [-f|--output-format ] [-l|--log-file ] - [-ll|--log-level ] [-?|-h|--help] + [-if|--include-files ] [-o|--output ] [-f|--output-format ] + [-l|--log-file ] [-ll|--log-level ] + [-dco|--disable-console-output] [--nologo] + [-?|-h|--help] ``` ### Arguments @@ -186,6 +199,14 @@ dotnet-coverage collect Sets the log level. Supported values: `Error`, `Info`, and `Verbose`. +* **`-dco|--disable-console-output`** + + Disables console output. + +* **`--nologo`** + + Do not display Code Coverage banner. + ## dotnet-coverage connect The `connect` command is used to connect with the existing server and collects code coverage data for any .NET process and its subprocesses. For example, you can collect code coverage data for a console application or a Blazor application. The command supports only .NET modules. Native modules are not supported. @@ -197,10 +218,11 @@ The `connect` command is used to connect with the existing server and collects c ```console dotnet-coverage connect + ... [-b|--background] [-t|--timeout] - [-l|--log-file ] [-ll|--log-level ] [-?|-h|--help] - - + [-l|--log-file ] [-ll|--log-level ] + [-dco|--disable-console-output] [--nologo] + [-?|-h|--help] ``` ### Arguments @@ -235,6 +257,14 @@ dotnet-coverage connect Sets the log level. Supported values: `Error`, `Info`, and `Verbose`. +* **`-dco|--disable-console-output`** + + Disables console output. + +* **`--nologo`** + + Do not display Code Coverage banner. + ## dotnet-coverage snapshot Creates a coverage file for existing code coverage collection. @@ -243,12 +273,14 @@ Creates a coverage file for existing code coverage collection. ```console dotnet-coverage snapshot + [-r|--reset] - [-o|--output ] [-tn|--tag-name ] [-tid|--tag-identifier ] + [-o|--output ] [-t|--timeout] - [-l|--log-file ] [-ll|--log-level ] [-?|-h|--help] - + [-l|--log-file ] [-ll|--log-level ] + [-dco|--disable-console-output] [--nologo] + [-?|-h|--help] ``` ### Arguments @@ -263,10 +295,6 @@ dotnet-coverage snapshot Clears existing coverage information after a coverage file is created. -* **`-o|--output `** - - Sets the code coverage report output file. If not provided, it's generated automatically with a timestamp. - * **`-tn|--tag-name `** Creates a snapshot tag name in the coverage file with current coverage information. Tag-name and tag-identifier are mutually inclusive. @@ -275,6 +303,10 @@ dotnet-coverage snapshot Creates a snapshot tag identifier in the coverage file with current coverage information. Tag-name and tag-identifier are mutually inclusive. +* **`-o|--output `** + + Sets the code coverage report output file. If not provided, it's generated automatically with a timestamp. + * **`-t|--timeout`** Timeout (in milliseconds) for interprocess communication between the client and the server. @@ -287,6 +319,14 @@ dotnet-coverage snapshot Sets the log level. Supported values: `Error`, `Info`, and `Verbose`. +* **`-dco|--disable-console-output`** + + Disables console output. + +* **`--nologo`** + + Do not display Code Coverage banner. + ## dotnet-coverage shutdown Closes existing code coverage collection. @@ -295,9 +335,11 @@ Closes existing code coverage collection. ```console dotnet-coverage shutdown - [-t|--timeout] - [-l|--log-file ] [-ll|--log-level ] [-?|-h|--help] + [-t|--timeout] + [-l|--log-file ] [-ll|--log-level ] + [-dco|--disable-console-output] [--nologo] + [-?|-h|--help] ``` ### Arguments @@ -320,6 +362,14 @@ dotnet-coverage shutdown Sets the log level. Supported values: `Error`, `Info`, and `Verbose`. +* **`-dco|--disable-console-output`** + + Disables console output. + +* **`--nologo`** + + Do not display Code Coverage banner. + ## dotnet-coverage instrument The instrument command is used to instrument binary on disk. @@ -328,10 +378,12 @@ The instrument command is used to instrument binary on disk. ```console dotnet-coverage instrument - [-s|--settings ] [-id|--session-id ] - [-o|--output ] [-l|--log-file ] - [-ll|--log-level ] [-?|-h|--help] + [-s|--settings ] [-id|--session-id ] + [-o|--output ] + [-l|--log-file ] [-ll|--log-level ] + [-dco|--disable-console-output] [--nologo] + [-?|-h|--help] ``` ### Arguments @@ -362,6 +414,57 @@ dotnet-coverage instrument Sets the log level. Supported values: `Error`, `Info`, and `Verbose`. +* **`-dco|--disable-console-output`** + + Disables console output. + +* **`--nologo`** + + Do not display Code Coverage banner. + +## dotnet-coverage uninstrument + +The uninstrument command is used to restore original binary from the instrumented binary. + +### Synopsis + +```console +Microsoft.CodeCoverage.Console uninstrument + + [-s|--settings ] + [-l|--log-file ] [-ll|--log-level ] + [-dco|--disable-console-output] [--nologo] + [-?|-h|--help] +``` + +### Arguments + +* **``** + + The input instrumented binary. + +### Options + +* **`-s|--settings `** + + Sets the path to the XML code coverage settings. + +* **`-l|--log-file `** + + Sets the log file path. When you provide a directory (with a path separator at the end), a new log file is generated for each process under analysis. + +* **`-ll|--log-level `** + + Sets the log level. Supported values: `Error`, `Info`, and `Verbose`. + +* **`-dco|--disable-console-output`** + + Disables console output. + +* **`--nologo`** + + Do not display Code Coverage banner. + ## Sample scenarios ## Collecting code coverage diff --git a/docs/core/testing/unit-testing-platform-extensions-code-coverage.md b/docs/core/testing/unit-testing-platform-extensions-code-coverage.md index df69be8f11ece..afc2096569486 100644 --- a/docs/core/testing/unit-testing-platform-extensions-code-coverage.md +++ b/docs/core/testing/unit-testing-platform-extensions-code-coverage.md @@ -12,10 +12,6 @@ This article list and explains all `Microsoft Testing Platform` extensions relat You can use the code coverage feature to determine what proportion of your project's code is being tested by coded tests such as unit tests. To effectively guard against bugs, your tests should exercise or *cover* a large proportion of your code. -## Coverlet - -There's currently no Coverlet extension, but you can use [Coverlet .NET global tool](https://github.com/coverlet-coverage/coverlet#net-global-tool-guide-suffers-from-possible-known-issue). - ## Microsoft code coverage Microsoft Code Coverage analysis is possible for both managed (CLR) and unmanaged (native) code. Both static and dynamic instrumentation are supported. This extension is shipped as part of [Microsoft.Testing.Extensions.CodeCoverage](https://nuget.org/packages/Microsoft.Testing.Extensions.CodeCoverage) NuGet package. @@ -39,3 +35,7 @@ Microsoft Code Coverage provides the following options: | `--coverage-settings` | XML code coverage settings. | For more information about the available options, see [settings](../additional-tools/dotnet-coverage.md#settings) and [samples](https://github.com/microsoft/codecoverage/tree/main/samples/Algorithms). + +## Coverlet + +There's currently no Coverlet extension, but you can use [Coverlet .NET global tool](https://github.com/coverlet-coverage/coverlet#net-global-tool-guide-suffers-from-possible-known-issue). diff --git a/docs/core/tools/dotnet-test.md b/docs/core/tools/dotnet-test.md index 78ee291b2b5b7..15b42be8fa322 100644 --- a/docs/core/tools/dotnet-test.md +++ b/docs/core/tools/dotnet-test.md @@ -272,16 +272,16 @@ 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/coverlet-coverage/coverlet/blob/master/Documentation/VSTestIntegration.md) collectors integration): +- Run the tests in the project in the current directory, and generate a code coverage file using [Microsoft Code Coverage](https://github.com/microsoft/codecoverage/blob/main/README.md): ```dotnetcli - dotnet test --collect:"XPlat Code Coverage" + dotnet test --collect "Code Coverage" ``` -- Run the tests in the project in the current directory, and generate a code coverage file (Windows only): +- Run the tests in the project in the current directory, and generate a code coverage file using [Coverlet](https://github.com/coverlet-coverage/coverlet/blob/master/README.md) (after installing [Coverlet](https://github.com/coverlet-coverage/coverlet/blob/master/Documentation/VSTestIntegration.md) collectors integration): ```dotnetcli - dotnet test --collect "Code Coverage" + dotnet test --collect:"XPlat Code Coverage" ``` - Run the tests in the project in the current directory, and log with detailed verbosity to the console: