2018-03-30 15:45:24 +00:00
. \"t
. \" Automatically generated by Pandoc 2.1.3
2016-06-14 13:42:21 +00:00
. \"
2018-03-30 15:45:24 +00:00
.TH "dotnet test command \- .NET Core CLI" "1" "" "" ".NET Core"
2016-06-14 13:42:21 +00:00
.hy
2018-03-30 15:45:24 +00:00
.SH dotnet test
.PP
.SH NAME
.PP
\f[C]dotnet\ test\f[] \- .NET test driver used to execute unit tests.
.SH SYNOPSIS
.SS .NET Core 2 .x
.IP
.nf
\f[C]
dotnet\ test\ [<PROJECT>]\ [\-a|\-\-test\-adapter\-path]\ [\-c|\-\-configuration]\ [\-\-collect]\ [\-d|\-\-diag]\ [\-f|\-\-framework]\ [\-\-filter]\ [\-l|\-\-logger]\ [\-\-no\-build]\ [\-\-no\-restore]\ [\-o|\-\-output]\ [\-r|\-\-results\-directory]\ [\-s|\-\-settings]\ [\-t|\-\-list\-tests]\ [\-v|\-\-verbosity]
dotnet\ test\ [\-h|\-\-help]
\f[]
.fi
.SS .NET Core 1 .x
.IP
.nf
\f[C]
dotnet\ test\ [<PROJECT>]\ [\-a|\-\-test\-adapter\-path]\ [\-c|\-\-configuration]\ [\-d|\-\-diag]\ [\-f|\-\-framework]\ [\-\-filter]\ [\-l|\-\-logger]\ [\-\-no\-build]\ [\-o|\-\-output]\ [\-s|\-\-settings]\ [\-t|\-\-list\-tests]\ \ [\-v|\-\-verbosity]
dotnet\ test\ [\-h|\-\-help]
\f[]
.fi
.PP
* * * * *
.SH DESCRIPTION
.PP
The \f[C]dotnet\ test\f[] command is used to execute unit tests in a given project.
The \f[C]dotnet\ test\f[] command launches the test runner console application specified for a project.
The test runner executes the tests defined for a unit test framework (for example, MSTest, NUnit, or xUnit) and reports the success or failure of each test.
The test runner and the unit test library are packaged as NuGet packages and are restored as ordinary dependencies for the project.
.PP
Test projects specify the test runner using an ordinary \f[C]<PackageReference>\f[] element, as seen in the following sample project file:
.PP
[!code\- xmlXUnit Basic Template]
.SS Arguments
.PP
\f[C]PROJECT\f[]
.PP
Specifies a path to the test project.
If omitted, it defaults to current directory.
.SH OPTIONS
.SS .NET Core 2 .x
.PP
\f[C]\-a|\-\-test\-adapter\-path\ <PATH_TO_ADAPTER>\f[]
.PP
Use the custom test adapters from the specified path in the test run.
.PP
\f[C]\-c|\-\-configuration\ {Debug|Release}\f[]
.PP
Defines the build configuration.
The default value is \f[C]Debug\f[] , but your project's configuration could override this default SDK setting.
.PP
\f[C]\-\-collect\ <DATA_COLLECTOR_FRIENDLY_NAME>\f[]
.PP
Enables data collector for the test run.
For more information, see Monitor and analyze test run.
.PP
\f[C]\-d|\-\-diag\ <PATH_TO_DIAGNOSTICS_FILE>\f[]
.PP
Enables diagnostic mode for the test platform and write diagnostic messages to the specified file.
.PP
\f[C]\-f|\-\-framework\ <FRAMEWORK>\f[]
.PP
Looks for test binaries for a specific framework.
.PP
\f[C]\-\-filter\ <EXPRESSION>\f[]
.PP
Filters out tests in the current project using the given expression.
For more information, see the Filter option details section.
For additional information and examples on how to use selective unit test filtering, see Running selective unit tests.
.PP
\f[C]\-h|\-\-help\f[]
.PP
Prints out a short help for the command.
.PP
\f[C]\-l|\-\-logger\ <LoggerUri/FriendlyName>\f[]
.PP
Specifies a logger for test results.
.PP
\f[C]\-\-no\-build\f[]
.PP
Does not build the test project prior to running it.
.PP
\f[C]\-\-no\-restore\f[]
.PP
Doesn't perform an implicit restore when running the command.
.PP
\f[C]\-o|\-\-output\ <OUTPUT_DIRECTORY>\f[]
.PP
Directory in which to find the binaries to run.
.PP
\f[C]\-r|\-\-results\-directory\ <PATH>\f[]
.PP
The directory where the test results are going to be placed.
The specified directory will be created if it doesn't exist.
.PP
\f[C]\-s|\-\-settings\ <SETTINGS_FILE>\f[]
.PP
Settings to use when running tests.
.PP
\f[C]\-t|\-\-list\-tests\f[]
.PP
List all of the discovered tests in the current project.
.PP
\f[C]\-v|\-\-verbosity\ <LEVEL>\f[]
.PP
Sets the verbosity level of the command.
Allowed values are \f[C]q[uiet]\f[], \f[C]m[inimal]\f[], \f[C]n[ormal]\f[], \f[C]d[etailed]\f[], and \f[C]diag[nostic]\f[] .
.SS .NET Core 1 .x
.PP
\f[C]\-a|\-\-test\-adapter\-path\ <PATH_TO_ADAPTER>\f[]
.PP
Use the custom test adapters from the specified path in the test run.
.PP
\f[C]\-c|\-\-configuration\ {Debug|Release}\f[]
.PP
Defines the build configuration.
The default value is \f[C]Debug\f[] , but your project's configuration could override this default SDK setting.
.PP
\f[C]\-d|\-\-diag\ <PATH_TO_DIAGNOSTICS_FILE>\f[]
.PP
Enables diagnostic mode for the test platform and write diagnostic messages to the specified file.
.PP
\f[C]\-f|\-\-framework\ <FRAMEWORK>\f[]
.PP
Looks for test binaries for a specific framework.
.PP
\f[C]\-\-filter\ <EXPRESSION>\f[]
.PP
Filters out tests in the current project using the given expression.
For more information, see the Filter option details section.
For additional information and examples on how to use selective unit test filtering, see Running selective unit tests.
.PP
\f[C]\-h|\-\-help\f[]
.PP
Prints out a short help for the command.
.PP
\f[C]\-l|\-\-logger\ <LoggerUri/FriendlyName>\f[]
.PP
Specifies a logger for test results.
.PP
\f[C]\-\-no\-build\f[]
.PP
Does not build the test project prior to running it.
.PP
\f[C]\-o|\-\-output\ <OUTPUT_DIRECTORY>\f[]
.PP
Directory in which to find the binaries to run.
.PP
\f[C]\-s|\-\-settings\ <SETTINGS_FILE>\f[]
.PP
Settings to use when running tests.
.PP
\f[C]\-t|\-\-list\-tests\f[]
.PP
List all of the discovered tests in the current project.
.PP
\f[C]\-v|\-\-verbosity\ <LEVEL>\f[]
.PP
Sets the verbosity level of the command.
Allowed values are \f[C]q[uiet]\f[], \f[C]m[inimal]\f[], \f[C]n[ormal]\f[], \f[C]d[etailed]\f[], and \f[C]diag[nostic]\f[] .
.PP
* * * * *
.SH EXAMPLES
.PP
Run the tests in the project in the current directory:
.PP
\f[C]dotnet\ test\f[]
.PP
Run the tests in the \f[C]test1\f[] project:
.PP
\f[C]dotnet\ test\ ~/projects/test1/test1.csproj\f[]
.SS Filter option details
.PP
\f[C]\-\-filter\ <EXPRESSION>\f[]
.PP
\f[C]<Expression>\f[] has the format \f[C]<property><operator><value>[|&<Expression>]\f[] .
.PP
\f[C]<property>\f[] is an attribute of the \f[C]Test\ Case\f[] .
The following are the properties supported by popular unit test frameworks:
.PP
.TS
tab(@);
c l.
T{
Test Framework
T}@T{
Supported properties
T}
_
.TE
| MSTest |
FullyQualifiedName
Name
ClassName
Priority
TestCategory
| | Xunit |
FullyQualifiedName
DisplayName
Traits
.IP
.nf
\f[C]
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ |
\f[]
.fi
.PP
The \f[C]<operator>\f[] describes the relationship between the property and the value:
.PP
.TS
tab(@);
c l.
T{
Operator
T}@T{
Function
T}
_
T{
\f[C]=\f[]
T}@T{
Exact match
T}
T{
\f[C]!=\f[]
T}@T{
Not exact match
T}
T{
\f[C]~\f[]
T}@T{
Contains
T}
.TE
.PP
\f[C]<value>\f[] is a string.
All the lookups are case insensitive.
.PP
An expression without an \f[C]<operator>\f[] is automatically considered as a \f[C]contains\f[] on \f[C]FullyQualifiedName\f[] property (for example, \f[C]dotnet\ test\ \-\-filter\ xyz\f[] is same as \f[C]dotnet\ test\ \-\-filter\ FullyQualifiedName~xyz\f[] ).
.PP
Expressions can be joined with conditional operators:
.PP
.TS
tab(@);
c c.
T{
Operator
T}@T{
Function
T}
_
T{
| \ \
T}@T{
OR \ \ \
T}
T{
\f[C]&\f[]
T}@T{
AND
T}
.TE
.PP
You can enclose expressions in parenthesis when using conditional operators (for example, \f[C](Name~TestMethod1)\ |\ (Name~TestMethod2)\f[] ).
.PP
For additional information and examples on how to use selective unit test filtering, see Running selective unit tests.
.SS See also
.PP
Frameworks and Targets
.PD 0
.P
.PD
\& .NET Core Runtime IDentifier (RID) catalog
2016-06-14 13:42:21 +00:00
.SH AUTHORS
2018-03-30 15:45:24 +00:00
mairaw.