1dotnet vstest command(1) .NET Core dotnet vstest command(1)
2
3
4
7 dotnet-vstest - Runs tests from the specified files.
8
10 .NET Core 2.1
11 dotnet vstest [<TEST_FILE_NAMES>] [--Settings|/Settings] [--Tests|/Tests] [--TestAdapterPath|/TestAdapterPath]
12 [--Platform|/Platform] [--Framework|/Framework] [--Parallel|/Parallel] [--TestCaseFilter|/TestCaseFilter] [--logger|/logger]
13 [-lt|--ListTests|/lt|/ListTests] [--ParentProcessId|/ParentProcessId] [--Port|/Port] [--Diag|/Diag] [--Blame|/Blame] [--InIsolation|/InIsolation]
14 [[--] <args>...]] [-?|--Help|/?|/Help]
15
16 .NET Core 2.0
17 dotnet vstest [<TEST_FILE_NAMES>] [--Settings|/Settings] [--Tests|/Tests] [--TestAdapterPath|/TestAdapterPath]
18 [--Platform|/Platform] [--Framework|/Framework] [--Parallel|/Parallel] [--TestCaseFilter|/TestCaseFilter] [--logger|/logger]
19 [-lt|--ListTests|/lt|/ListTests] [--ParentProcessId|/ParentProcessId] [--Port|/Port] [--Diag|/Diag] [[--] <args>...]] [-?|--Help|/?|/Help]
20
21 .NET Core 1.x
22 dotnet vstest [<TEST_FILE_NAMES>] [--Settings|/Settings] [--Tests|/Tests] [--TestAdapterPath|/TestAdapterPath]
23 [--Platform|/Platform] [--Framework|/Framework] [--Parallel|/Parallel] [--TestCaseFilter|/TestCaseFilter] [--logger|/logger]
24 [-lt|--ListTests|/lt|/ListTests] [--ParentProcessId|/ParentProcessId] [--Port|/Port] [--Diag|/Diag] [[--] <args>...]] [-?|--Help|/?|/Help]
25
26 * * * * *
27
29 The dotnet-vstest command runs the VSTest.Console command-line applica‐
30 tion to run automated unit tests.
31
32 Arguments
33 TEST_FILE_NAMES
34
35 Run tests from the specified assemblies. Separate multiple test assem‐
36 bly names with spaces.
37
39 .NET Core 2.1
40 --Settings|/Settings:<Settings File>
41
42 Settings to use when running tests.
43
44 --Tests|/Tests:<Test Names>
45
46 Run tests with names that match the provided values. Separate multiple
47 values with commas.
48
49 --TestAdapterPath|/TestAdapterPath
50
51 Use custom test adapters from a given path (if any) in the test run.
52
53 --Platform|/Platform:<Platform type>
54
55 Target platform architecture used for test execution. Valid values are
56 x86, x64, and ARM.
57
58 --Framework|/Framework:<Framework Version>
59
60 Target .NET Framework version used for test execution. Examples of
61 valid values are .NETFramework,Version=v4.6 or .NETCoreApp,Ver‐
62 sion=v1.0. Other supported values are Framework40, Framework45, Frame‐
63 workCore10, and FrameworkUap10.
64
65 --Parallel|/Parallel
66
67 Execute tests in parallel. By default, all available cores on the ma‐
68 chine are available for use. Specify an explicit number of cores by
69 setting the MaxCpuCount property under the RunConfiguration node in the
70 runsettings file.
71
72 --TestCaseFilter|/TestCaseFilter:<Expression>
73
74 Run tests that match the given expression. <Expression> is of the for‐
75 mat <property>Operator<value>[|&<Expression>], where Operator is one of
76 =, !=, or ~. Operator ~ has `contains' semantics and is applicable for
77 string properties like DisplayName. Parenthesis () are used to group
78 sub-expressions.
79
80 -?|--Help|/?|/Help
81
82 Prints out a short help for the command.
83
84 --logger|/logger:<Logger Uri/FriendlyName>
85
86 Specify a logger for test results.
87
88 · To publish test results to Team Foundation Server, use the TfsPub‐
89 lisher logger provider:
90
91 /logger:TfsPublisher;
92 Collection=<team project collection url>;
93 BuildName=<build name>;
94 TeamProject=<team project name>
95 [;Platform=<Defaults to "Any CPU">]
96 [;Flavor=<Defaults to "Debug">]
97 [;RunTitle=<title>]
98
99 · To log results to a Visual Studio Test Results File (TRX), use the
100 trx logger provider. This switch creates a file in the test results
101 directory with given log file name. If LogFileName isn’t provided, a
102 unique file name is created to hold the test results.
103
104 /logger:trx [;LogFileName=<Defaults to unique file name>]
105
106 -lt|--ListTests|/lt|/ListTests:<File Name>
107
108 Lists all discovered tests from the given test container.
109
110 --ParentProcessId|/ParentProcessId:<ParentProcessId>
111
112 Process ID of the parent process responsible for launching the current
113 process.
114
115 --Port|/Port:<Port>
116
117 Specifies the port for the socket connection and receiving the event
118 messages.
119
120 --Diag|/Diag:<Path to log file>
121
122 Enables verbose logs for the test platform. Logs are written to the
123 provided file.
124
125 --Blame|/Blame
126
127 Runs the tests in blame mode. This option is helpful in isolating the
128 problematic tests causing test host to crash. It creates an output
129 file in the current directory as Sequence.xml that captures the order
130 of tests execution before the crash.
131
132 --InIsolation|/InIsolation
133
134 Runs the tests in an isolated process. This makes vstest.console.exe
135 process less likely to be stopped on an error in the tests, but tests
136 may run slower.
137
138 @<file>
139
140 Reads response file for more options.
141
142 args
143
144 Specifies extra arguments to pass to the adapter. Arguments are speci‐
145 fied as name-value pairs of the form <n>=<v>, where <n> is the argument
146 name and <v> is the argument value. Use a space to separate multiple
147 arguments.
148
149 .NET Core 2.0
150 --Settings|/Settings:<Settings File>
151
152 Settings to use when running tests.
153
154 --Tests|/Tests:<Test Names>
155
156 Run tests with names that match the provided values. Separate multiple
157 values with commas.
158
159 --TestAdapterPath|/TestAdapterPath
160
161 Use custom test adapters from a given path (if any) in the test run.
162
163 --Platform|/Platform:<Platform type>
164
165 Target platform architecture used for test execution. Valid values are
166 x86, x64, and ARM.
167
168 --Framework|/Framework:<Framework Version>
169
170 Target .NET Framework version used for test execution. Examples of
171 valid values are .NETFramework,Version=v4.6 or .NETCoreApp,Ver‐
172 sion=v1.0. Other supported values are Framework40, Framework45, and
173 FrameworkCore10.
174
175 --Parallel|/Parallel
176
177 Execute tests in parallel. By default, all available cores on the ma‐
178 chine are available for use. Specify an explicit number of cores by
179 setting the MaxCpuCount property under the RunConfiguration node in the
180 runsettings file.
181
182 --TestCaseFilter|/TestCaseFilter:<Expression>
183
184 Run tests that match the given expression. <Expression> is of the for‐
185 mat <property>Operator<value>[|&<Expression>], where Operator is one of
186 =, !=, or ~. Operator ~ has `contains' semantics and is applicable for
187 string properties like DisplayName. Parenthesis () are used to group
188 sub-expressions.
189
190 -?|--Help|/?|/Help
191
192 Prints out a short help for the command.
193
194 --logger|/logger:<Logger Uri/FriendlyName>
195
196 Specify a logger for test results.
197
198 · To publish test results to Team Foundation Server, use the TfsPub‐
199 lisher logger provider:
200
201 /logger:TfsPublisher;
202 Collection=<team project collection url>;
203 BuildName=<build name>;
204 TeamProject=<team project name>
205 [;Platform=<Defaults to "Any CPU">]
206 [;Flavor=<Defaults to "Debug">]
207 [;RunTitle=<title>]
208
209 · To log results to a Visual Studio Test Results File (TRX), use the
210 trx logger provider. This switch creates a file in the test results
211 directory with given log file name. If LogFileName isn’t provided, a
212 unique file name is created to hold the test results.
213
214 /logger:trx [;LogFileName=<Defaults to unique file name>]
215
216 -lt|--ListTests|/lt|/ListTests:<File Name>
217
218 Lists all discovered tests from the given test container.
219
220 --ParentProcessId|/ParentProcessId:<ParentProcessId>
221
222 Process ID of the parent process responsible for launching the current
223 process.
224
225 --Port|/Port:<Port>
226
227 Specifies the port for the socket connection and receiving the event
228 messages.
229
230 --Diag|/Diag:<Path to log file>
231
232 Enables verbose logs for the test platform. Logs are written to the
233 provided file.
234
235 args
236
237 Specifies extra arguments to pass to the adapter. Arguments are speci‐
238 fied as name-value pairs of the form <n>=<v>, where <n> is the argument
239 name and <v> is the argument value. Use a space to separate multiple
240 arguments.
241
242 .NET Core 1.x
243 --Settings|/Settings:<Settings File>
244
245 Settings to use when running tests.
246
247 --Tests|/Tests:<Test Names>
248
249 Run tests with names that match the provided values. Separate multiple
250 values with commas.
251
252 --TestAdapterPath|/TestAdapterPath
253
254 Use custom test adapters from a given path (if any) in the test run.
255
256 --Platform|/Platform:<Platform type>
257
258 Target platform architecture used for test execution. Valid values are
259 x86, x64, and ARM.
260
261 --Framework|/Framework:<Framework Version>
262
263 Target .NET Framework version used for test execution. Examples of
264 valid values are .NETFramework,Version=v4.6 or .NETCoreApp,Ver‐
265 sion=v1.0. Other supported values are Framework40, Framework45, and
266 FrameworkCore10.
267
268 --Parallel|/Parallel
269
270 Execute tests in parallel. By default, all available cores on the ma‐
271 chine are available for use. Specify an explicit number of cores by
272 setting the MaxCpuCount property under the RunConfiguration node in the
273 runsettings file.
274
275 --TestCaseFilter|/TestCaseFilter:<Expression>
276
277 Run tests that match the given expression. <Expression> is of the for‐
278 mat <property>Operator<value>[|&<Expression>], where Operator is one of
279 =, !=, or ~. Operator ~ has `contains' semantics and is applicable for
280 string properties like DisplayName. Parenthesis () are used to group
281 sub-expressions.
282
283 -?|--Help|/?|/Help
284
285 Prints out a short help for the command.
286
287 --logger|/logger:<Logger Uri/FriendlyName>
288
289 Specify a logger for test results.
290
291 · To publish test results to Team Foundation Server, use the TfsPub‐
292 lisher logger provider:
293
294 /logger:TfsPublisher;
295 Collection=<team project collection url>;
296 BuildName=<build name>;
297 TeamProject=<team project name>
298 [;Platform=<Defaults to "Any CPU">]
299 [;Flavor=<Defaults to "Debug">]
300 [;RunTitle=<title>]
301
302 · To log results to a Visual Studio Test Results File (TRX), use the
303 trx logger provider. This switch creates a file in the test results
304 directory with given log file name. If LogFileName isn’t provided, a
305 unique file name is created to hold the test results.
306
307 /logger:trx [;LogFileName=<Defaults to unique file name>]
308
309 -lt|--ListTests|/lt|/ListTests:<File Name>
310
311 Lists all discovered tests from the given test container.
312
313 --ParentProcessId|/ParentProcessId:<ParentProcessId>
314
315 Process ID of the parent process responsible for launching the current
316 process.
317
318 --Port|/Port:<Port>
319
320 Specifies the port for the socket connection and receiving the event
321 messages.
322
323 --Diag|/Diag:<Path to log file>
324
325 Enables verbose logs for the test platform. Logs are written to the
326 provided file.
327
328 args
329
330 Specifies extra arguments to pass to the adapter. Arguments are speci‐
331 fied as name-value pairs of the form <n>=<v>, where <n> is the argument
332 name and <v> is the argument value. Use a space to separate multiple
333 arguments.
334
335 * * * * *
336
338 Run tests in mytestproject.dll:
339
340 dotnet vstest mytestproject.dll
341
342 Run tests in mytestproject.dll, exporting to custom folder with custom
343 name:
344
345 dotnet vstest mytestproject.dll --logger:"trx;LogFileName=cus‐
346 tom_file_name.trx" --ResultsDirectory:custom/file/path
347
348 Run tests in mytestproject.dll and myothertestproject.exe:
349
350 dotnet vstest mytestproject.dll myothertestproject.exe
351
352 Run TestMethod1 tests:
353
354 dotnet vstest /Tests:TestMethod1
355
356 Run TestMethod1 and TestMethod2 tests:
357
358 dotnet vstest /Tests:TestMethod1,TestMethod2
359
361 mairaw.
362
363
364
365 dotnet vstest command(1)