Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
This article gives a central entry point for MTP command-line options.
Platform options
@Specifies the name of the response file. The response file name must immediately follow the
@character with no white space between the@character and the response file name.Options in a response file are interpreted as if they were present at that place in the command line. You can't use the backslash character
\to concatenate lines. Using a response file helps for very long commands that might exceed the terminal limits. You can combine a response file with inline command-line arguments. For example:./TestExecutable.exe @"filter.rsp" --timeout 10swhere filter.rsp can have the following contents:
--filter "A very long filter"Or a single rsp file can be used to specify both timeout and filter as follows:
./TestExecutable.exe @"arguments.rsp"--filter "A very long filter" --timeout 10sNote
When using
dotnet test, the SDK command-line parser uses a token-per-line approach where each line in the response file is treated as a single token. In that case, each argument must be on a separate line:--filter A very long filter --timeout 10s--config-fileSpecifies a testconfig.json file.
--debugPauses test execution at startup so you can attach a debugger to the test process. Equivalent to setting the
TESTINGPLATFORM_WAIT_ATTACH_DEBUGGERenvironment variable to1. Not supported on browser platforms.Note
This option is available in MTP starting with version 1.9.0. It replaces the previous
--debug-wait-attachoption (introduced in MTP 1.6.0); the old name was removed and must no longer be used.--diagnosticEnables the diagnostic logging. The default log level is
Trace. The file is written in the output directory with the following name format,log_[MMddHHssfff].diag.--diagnostic-synchronous-writeForces the built-in file logger to synchronously write logs. Useful for scenarios where you don't want to lose any log entries (if the process crashes). This slows down the test execution.
--diagnostic-output-directoryThe output directory of the diagnostic logging, if not specified the file is generated in the default TestResults directory.
--diagnostic-file-prefixThe prefix for the log file name. Defaults to
"log".--diagnostic-verbosityDefines the verbosity level when the
--diagnosticswitch is used. The available values areTrace,Debug,Information,Warning,Error, orCritical.--exit-on-process-exitExit the test process if dependent process exits. PID must be provided.
--filter-uidFilters the tests to run by their test node UIDs. Accepts one or more UIDs.
Note
This option is available in MTP starting with version 1.8.0.
--helpPrints out a description of how to use the command.
--ignore-exit-codeAllows some non-zero exit codes to be ignored, and instead returned as
0. For more information, see Ignore specific exit codes.--infoDisplays advanced information about the .NET Test Application such as:
- The platform.
- The environment.
- Each registered command line provider, such as its
name,version,description, andoptions. - Each registered tool, such as its
command,name,version,description, and all command-line providers.
This feature is used to understand extensions that would be registering the same command line option or the changes in available options between multiple versions of an extension (or the platform).
--list-testsLists the available tests without executing them. Optionally takes an argument that controls the output format:
text(default, human-readable) orjson.Note
The
jsonoutput format is available in MTP starting with version 2.3.0.--maximum-failed-testsSpecifies the maximum number of tests failures that, when reached, will stop the test run. Support for this switch requires framework authors to implement the
IGracefulStopTestExecutionCapabilitycapability. The exit code when reaching that amount of test failures is 13. For more information, see MTP exit codes.Note
This feature is available in MTP starting with version 1.5.
--minimum-expected-testsSpecifies the minimum number of tests that are expected to run. By default, at least one test is expected to run.
--no-bannerDisables the startup banner, the copyright message, and the telemetry banner. The same effect can be achieved through the
TESTINGPLATFORM_NOBANNERorDOTNET_NOLOGOenvironment variables.--results-directoryThe directory where the test results are going to be placed. If the specified directory doesn't exist, it's created. The default is
TestResultsin the directory that contains the test application.--timeoutA global test execution timeout. Takes one argument as string in the format
<value>[h|m|s]where<value>is float.--treenode-filterFilters the tests to run by using a tree filter expression. Tree filters offer richer matching than
--filterfor advanced scenarios.
Extension options by scenario
Use the following table to find extension options quickly.
| Scenario | Feature documentation |
|---|---|
| Collect code coverage | Code coverage |
| Collect crash or hang dumps | Crash and hang dumps |
| Generate test reports (for example TRX) | Test reports |
| Customize terminal output | Terminal output |
| Apply hosting-level controls | Hot Reload |
| Retry failed tests | Retry |
| Run tests that use Microsoft Fakes | Microsoft Fakes |
| Emit OpenTelemetry traces and metrics | OpenTelemetry |
Discover options in your test app
Run your test executable with --help to list the options available for your current extension set.
For advanced diagnostics of registered providers and options, run with --info.