dotnet test
dotnet test --help
eg@debian:~$ dotnet test --help
Description:
.NET Test Driver
Usage:
dotnet test [options] [[--] <additional arguments>...]]
Options:
-s, --settings <SETTINGS_FILE> The settings file to use when running tests.
-t, --list-tests List the discovered tests instead of running the tests.
-e, --environment <NAME="VALUE"> Sets the value of an environment variable.
Creates the variable if it does not exist, overrides if it does.
This will force the tests to be run in an isolated process.
This argument can be specified multiple times to provide multiple variables.
Examples:
-e VARIABLE=abc
-e VARIABLE="value with spaces"
-e VARIABLE="value;seperated with;semicolons"
-e VAR1=abc -e VAR2=def -e VAR3=ghi
--filter <EXPRESSION> Run tests that match the given expression.
Examples:
Run tests with priority set to 1: --filter "Priority = 1"
Run a test with the specified full name: --filter
"FullyQualifiedName=Namespace.ClassName.MethodName"
Run tests that contain the specified name: --filter
"FullyQualifiedName~Namespace.Class"
See https://aka.ms/vstest-filtering for more information on filtering support.
--test-adapter-path <ADAPTER_PATH> The path to the custom adapters to use for the test run.
-l, --logger <LOGGER> The logger to use for test results.
Examples:
Log in trx format using a unique file name: --logger trx
Log in trx format using the specified file name: --logger
"trx;LogFileName=<TestResults.trx>"
See https://aka.ms/vstest-report for more information on logger arguments.
-o, --output <OUTPUT_DIR> The output directory to place built artifacts in.
-d, --diag <LOG_FILE> Enable verbose logging to the specified file.
--no-build Do not build the project before testing. Implies --no-restore.
--results-directory <RESULTS_DIR> The directory where the test results will be placed.
The specified directory will be created if it does not exist.
--collect <DATA_COLLECTOR_NAME> The friendly name of the data collector to use for the test run.
More info here: https://aka.ms/vstest-collect
--blame Runs the tests in blame mode. This option is helpful in isolating problematic tests that cause the test host to crash or hang.
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.
Based on the additional settings, hang dump or crash dump can also be collected.
Example:
Timeout the test run when test takes more than the default timeout of 1 hour, and collect crash dump when the test host
exits unexpectedly.
(Crash dumps require additional setup, see below.)
dotnet test --blame-hang --blame-crash
Example:
Timeout the test run when a test takes more than 20 minutes and collect hang dump.
dotnet test --blame-hang-timeout 20min
--blame-crash Runs the tests in blame mode and enables collecting crash dump when testhost exits unexpectedly.
This option is currently only supported on Windows, and requires procdump.exe and procdump64.exe to be available in PATH.
Or PROCDUMP_PATH environment variable to be set, and point to a directory that contains procdump.exe and procdump64.exe.
The tools can be downloaded here: https://docs.microsoft.com/sysinternals/downloads/procdump
Implies --blame.
--blame-crash-dump-type <blame-crash-dump-type> The type of crash dump to be collected. Implies --blame-crash.
--blame-crash-collect-always <blame-crash-collect-always> Enables collecting crash dump on expected as well as unexpected testhost exit.
--blame-hang Run the tests in blame mode and enables collecting hang dump when test exceeds the given timeout. Implies --blame-hang.
--blame-hang-dump-type <blame-hang-dump-type> The type of crash dump to be collected. When None, is used then test host is terminated on timeout, but no dump is collected.
Implies --blame-hang.
--blame-hang-timeout <TIMESPAN> Per-test timeout, after which hang dump is triggered and the testhost process is terminated.
The timeout value is specified in the following format: 1.5h / 90m / 5400s / 5400000ms. When no unit is used (e.g. 5400000),
the value is assumed to be in milliseconds.
When used together with data driven tests, the timeout behavior depends on the test adapter used. For xUnit and NUnit the
timeout is renewed after every test case,
For MSTest, the timeout is used for all testcases.
This option is currently supported only on Windows together with netcoreapp2.1 and newer. And on Linux with netcoreapp3.1 and
newer. OSX and UWP are not supported.
--nologo Run test(s), without displaying Microsoft Testplatform banner
-c, --configuration <CONFIGURATION> The configuration to use for running tests. The default for most projects is 'Debug'.
-f, --framework <FRAMEWORK> The target framework to run tests for. The target framework must also be specified in the project file.
-r, --runtime <RUNTIME_IDENTIFIER> The target runtime to test for.
--no-restore Do not restore the project before building.
--interactive Allows the command to stop and wait for user input or action (for example to complete authentication).
-v, --verbosity <LEVEL> Set the MSBuild verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic].
-a, --arch <arch> The target architecture.
--os <os> The target operating system.
-?, -h, --help Show command line help.
Additional Arguments:
Arguments passed to the application that is being run.
Last updated