1dotnet test command - .NET Core CLI(.1N)ET Cdoortenet test command - .NET Core CLI(1)
2
3
4

dotnet test

NAME

7       dotnet test - .NET test driver used to execute unit tests.
8

SYNOPSIS

10   .NET Core 2.1
11              dotnet test [<PROJECT>] [-a|--test-adapter-path] [--blame] [-c|--configuration] [--collect] [-d|--diag] [-f|--framework] [--filter]
12                  [-l|--logger] [--no-build] [--no-restore] [-o|--output] [-r|--results-directory] [-s|--settings] [-t|--list-tests] [-v|--verbosity]
13              dotnet test [-h|--help]
14
15   .NET Core 2.0
16              dotnet test [<PROJECT>] [-a|--test-adapter-path] [-c|--configuration] [--collect] [-d|--diag] [-f|--framework] [--filter]
17                  [-l|--logger] [--no-build] [--no-restore] [-o|--output] [-r|--results-directory] [-s|--settings] [-t|--list-tests] [-v|--verbosity]
18              dotnet test [-h|--help]
19
20   .NET Core 1.x
21              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]
22              dotnet test [-h|--help]
23
24          *   *   *   *   *
25

DESCRIPTION

27       The  dotnet test  command  is  used  to  execute  unit tests in a given
28       project.  The dotnet test command launches the test runner console  ap‐
29       plication  specified for a project.  The test runner executes the tests
30       defined for a unit test framework (for example, MSTest, NUnit,  or  xU‐
31       nit)  and reports the success or failure of each test.  The test runner
32       and the unit test library are packaged as NuGet packages  and  are  re‐
33       stored as ordinary dependencies for the project.
34
35       Test  projects specify the test runner using an ordinary <PackageRefer‐
36       ence> element, as seen in the following sample project file:
37
38       [!code-xmlXUnit Basic Template]
39
40   Arguments
41       PROJECT
42
43       Path to the test project.  If not specified, it defaults to current di‐
44       rectory.
45

OPTIONS

47   .NET Core 2.1
48       -a|--test-adapter-path <PATH_TO_ADAPTER>
49
50       Use the custom test adapters from the specified path in the test run.
51
52       --blame
53
54       Runs  the tests in blame mode.  This option is helpful in isolating the
55       problematic tests causing test host to crash.   It  creates  an  output
56       file  in  the current directory as Sequence.xml that captures the order
57       of tests execution before the crash.
58
59       -c|--configuration {Debug|Release}
60
61       Defines the build configuration.  The default value is Debug, but  your
62       project's configuration could override this default SDK setting.
63
64       --collect <DATA_COLLECTOR_FRIENDLY_NAME>
65
66       Enables  data  collector  for  the test run.  For more information, see
67       Monitor and analyze test run.
68
69       -d|--diag <PATH_TO_DIAGNOSTICS_FILE>
70
71       Enables diagnostic mode for the test platform and write diagnostic mes‐
72       sages to the specified file.
73
74       -f|--framework <FRAMEWORK>
75
76       Looks for test binaries for a specific framework.
77
78       --filter <EXPRESSION>
79
80       Filters  out  tests  in the current project using the given expression.
81       For more information, see the Filter option details section.  For  more
82       information  and  examples on how to use selective unit test filtering,
83       see Running selective unit tests.
84
85       -h|--help
86
87       Prints out a short help for the command.
88
89       -l|--logger <LoggerUri/FriendlyName>
90
91       Specifies a logger for test results.
92
93       --no-build
94
95       Doesn't build the test project before running  it.   It  also  implicit
96       sets the --no-restore flag.
97
98       --no-restore
99
100       Doesn't execute an implicit restore when running the command.
101
102       -o|--output <OUTPUT_DIRECTORY>
103
104       Directory in which to find the binaries to run.
105
106       -r|--results-directory <PATH>
107
108       The  directory  where  the test results are going to be placed.  If the
109       specified directory doesn't exist, it's created.
110
111       -s|--settings <SETTINGS_FILE>
112
113       Settings to use when running tests.
114
115       -t|--list-tests
116
117       List all of the discovered tests in the current project.
118
119       -v|--verbosity <LEVEL>
120
121       Sets the verbosity level of the command.  Allowed values  are  q[uiet],
122       m[inimal], n[ormal], d[etailed], and diag[nostic].
123
124   .NET Core 2.0
125       -a|--test-adapter-path <PATH_TO_ADAPTER>
126
127       Use the custom test adapters from the specified path in the test run.
128
129       -c|--configuration {Debug|Release}
130
131       Defines  the build configuration.  The default value is Debug, but your
132       project's configuration could override this default SDK setting.
133
134       --collect <DATA_COLLECTOR_FRIENDLY_NAME>
135
136       Enables data collector for the test run.   For  more  information,  see
137       Monitor and analyze test run.
138
139       -d|--diag <PATH_TO_DIAGNOSTICS_FILE>
140
141       Enables diagnostic mode for the test platform and write diagnostic mes‐
142       sages to the specified file.
143
144       -f|--framework <FRAMEWORK>
145
146       Looks for test binaries for a specific framework.
147
148       --filter <EXPRESSION>
149
150       Filters out tests in the current project using  the  given  expression.
151       For  more information, see the Filter option details section.  For more
152       information and examples on how to use selective unit  test  filtering,
153       see Running selective unit tests.
154
155       -h|--help
156
157       Prints out a short help for the command.
158
159       -l|--logger <LoggerUri/FriendlyName>
160
161       Specifies a logger for test results.
162
163       --no-build
164
165       Doesn't  build  the  test  project before running it.  It also implicit
166       sets the --no-restore flag.
167
168       --no-restore
169
170       Doesn't execute an implicit restore when running the command.
171
172       -o|--output <OUTPUT_DIRECTORY>
173
174       Directory in which to find the binaries to run.
175
176       -r|--results-directory <PATH>
177
178       The directory where the test results are going to be  placed.   If  the
179       specified directory doesn't exist, it's created.
180
181       -s|--settings <SETTINGS_FILE>
182
183       Settings to use when running tests.
184
185       -t|--list-tests
186
187       List all of the discovered tests in the current project.
188
189       -v|--verbosity <LEVEL>
190
191       Sets  the  verbosity level of the command.  Allowed values are q[uiet],
192       m[inimal], n[ormal], d[etailed], and diag[nostic].
193
194   .NET Core 1.x
195       -a|--test-adapter-path <PATH_TO_ADAPTER>
196
197       Use the custom test adapters from the specified path in the test run.
198
199       -c|--configuration {Debug|Release}
200
201       Defines the build configuration.  The default value is Debug, but  your
202       project's configuration could override this default SDK setting.
203
204       -d|--diag <PATH_TO_DIAGNOSTICS_FILE>
205
206       Enables diagnostic mode for the test platform and write diagnostic mes‐
207       sages to the specified file.
208
209       -f|--framework <FRAMEWORK>
210
211       Looks for test binaries for a specific framework.
212
213       --filter <EXPRESSION>
214
215       Filters out tests in the current project using  the  given  expression.
216       For  more information, see the Filter option details section.  For more
217       information and examples on how to use selective unit  test  filtering,
218       see Running selective unit tests.
219
220       -h|--help
221
222       Prints out a short help for the command.
223
224       -l|--logger <LoggerUri/FriendlyName>
225
226       Specifies a logger for test results.
227
228       --no-build
229
230       Doesn't build the test project before running it.
231
232       -o|--output <OUTPUT_DIRECTORY>
233
234       Directory in which to find the binaries to run.
235
236       -s|--settings <SETTINGS_FILE>
237
238       Settings to use when running tests.
239
240       -t|--list-tests
241
242       List all of the discovered tests in the current project.
243
244       -v|--verbosity <LEVEL>
245
246       Sets  the  verbosity level of the command.  Allowed values are q[uiet],
247       m[inimal], n[ormal], d[etailed], and diag[nostic].
248
249          *   *   *   *   *
250

EXAMPLES

252       Run the tests in the project in the current directory:
253
254       dotnet test
255
256       Run the tests in the test1 project:
257
258       dotnet test ~/projects/test1/test1.csproj
259
260   Filter option details
261       --filter <EXPRESSION>
262
263       <Expression>  has  the  format   <property><operator><value>[|&<Expres‐
264       sion>].
265
266       <property>  is  an  attribute  of the Test Case.  The following are the
267       properties supported by popular unit test frameworks:
268
269       Test Framework   Supported properties
270       ──────────────────────────────────────
271       | MSTest | FullyQualifiedName Name ClassName Priority TestCategory |  |
272       xUnit | FullyQualifiedName DisplayName Traits
273
274                                             |
275
276       The  <operator> describes the relationship between the property and the
277       value:
278
279       Operator   Function
280       ───────────────────────────
281          =       Exact match
282          !=      Not exact match
283          ~       Contains
284
285       <value> is a string.  All the lookups are case insensitive.
286
287       An expression without an <operator> is automatically  considered  as  a
288       contains    on   FullyQualifiedName   property   (for   example,   dot‐
289       net test --filter xyz is same  as  dotnet test --filter FullyQualified‐
290       Name~xyz).
291
292       Expressions can be joined with conditional operators:
293
294       Operator   Function
295       ────────────────────
296       |          OR
297       &          AND
298
299       You can enclose expressions in parenthesis when using conditional oper‐
300       ators (for example, (Name~TestMethod1) | (Name~TestMethod2)).
301
302       For more information and examples on how to  use  selective  unit  test
303       filtering, see Running selective unit tests.
304
305   See also
306       Frameworks and Targets
307       .NET Core Runtime IDentifier (RID) catalog
308

AUTHORS

310       mairaw.
311
312
313
314                                        dotnet test command - .NET Core CLI(1)
Impressum