1dotnet-vstest(1)              .NET Documentation              dotnet-vstest(1)
2
3
4

dotnet vstest

6       This article applies to: ✔️ .NET Core 3.1 SDK and later versions
7
8              The  dotnet  vstest  command is superseded by dotnet test, which
9              can now be used to run assemblies.  See dotnet test.
10

NAME

12       dotnet-vstest - Runs tests from the specified assemblies.
13

SYNOPSIS

15              dotnet vstest [<TEST_FILE_NAMES>] [--Blame] [--Diag <PATH_TO_LOG_FILE>]
16                  [--Framework <FRAMEWORK>] [--InIsolation] [-lt|--ListTests <FILE_NAME>]
17                  [--logger <LOGGER_URI/FRIENDLY_NAME>] [--Parallel]
18                  [--ParentProcessId <PROCESS_ID>] [--Platform] <PLATFORM_TYPE>
19                  [--Port <PORT>] [--ResultsDirectory<PATH>] [--Settings <SETTINGS_FILE>]
20                  [--TestAdapterPath <PATH>] [--TestCaseFilter <EXPRESSION>]
21                  [--Tests <TEST_NAMES>] [[--] <args>...]]
22
23              dotnet vstest -?|--Help
24

DESCRIPTION

26       The dotnet vstest command runs the VSTest.Console command-line applica‐
27       tion to run automated unit tests.
28

ARGUMENTS

30TEST_FILE_NAMES
31
32         Run  tests from the specified assemblies.  Separate multiple test as‐
33         sembly names with spaces.  Wildcards are supported.
34

OPTIONS

36--Blame
37
38         Runs the tests in blame mode.  This option is  helpful  in  isolating
39         the problematic tests causing test host to crash.  It creates an out‐
40         put file in the current directory as Sequence.xml that  captures  the
41         order of tests execution before the crash.
42
43--Diag <PATH_TO_LOG_FILE>
44
45         Enables  verbose logs for the test platform.  Logs are written to the
46         provided file.
47
48--Framework <FRAMEWORK>
49
50         Target .NET Framework version used for test execution.   Examples  of
51         valid   values  are  .NETFramework,Version=v4.6  or  .NETCoreApp,Ver‐
52         sion=v1.0.  Other  supported  values  are  Framework40,  Framework45,
53         FrameworkCore10, and FrameworkUap10.
54
55--InIsolation
56
57         Runs the tests in an isolated process.  This makes vstest.console.exe
58         process less likely to be stopped on an error in the tests, but tests
59         may run slower.
60
61-lt|--ListTests <FILE_NAME>
62
63         Lists all discovered tests from the given test container.
64
65--logger <LOGGER_URI/FRIENDLY_NAME>
66
67         Specify a logger for test results.
68
69         • To  publish test results to Team Foundation Server, use the TfsPub‐
70           lisher logger provider:
71
72                  /logger:TfsPublisher;
73                      Collection=<team project collection url>;
74                      BuildName=<build name>;
75                      TeamProject=<team project name>
76                      [;Platform=<Defaults to "Any CPU">]
77                      [;Flavor=<Defaults to "Debug">]
78                      [;RunTitle=<title>]
79
80         • To log results to a Visual Studio Test Results File (TRX), use  the
81           trx  logger  provider.   This switch creates a file in the test re‐
82           sults directory with given log file  name.   If  LogFileName  isn’t
83           provided, a unique file name is created to hold the test results.
84
85                  /logger:trx [;LogFileName=<Defaults to unique file name>]
86
87--Parallel
88
89         Run  tests  in  parallel.  By default, all available cores on the ma‐
90         chine are available for use.  Specify an explicit number of cores  by
91         setting  the  MaxCpuCount property under the RunConfiguration node in
92         the runsettings file.
93
94--ParentProcessId <PROCESS_ID>
95
96         Process ID of the parent process responsible for launching  the  cur‐
97         rent process.
98
99--Platform <PLATFORM_TYPE>
100
101         Target  platform  architecture used for test execution.  Valid values
102         are x86, x64, and ARM.
103
104--Port <PORT>
105
106         Specifies the port for the socket connection and receiving the  event
107         messages.
108
109--ResultsDirectory:<PATH>
110
111         Test  results  directory will be created in specified path if not ex‐
112         ists.
113
114--Settings <SETTINGS_FILE>
115
116         Settings to use when running tests.
117
118--TestAdapterPath <PATH>
119
120         Use custom test adapters from a given path (if any) in the test run.
121
122--TestCaseFilter <EXPRESSION>
123
124         Run tests that match the given expression.  <EXPRESSION>  is  of  the
125         format  <property>Operator<value>[|&<EXPRESSION>],  where Operator is
126         one of =, !=, or ~.  Operator ~ has `contains' semantics and  is  ap‐
127         plicable  for string properties like DisplayName.  Parentheses () are
128         used to group subexpressions.  For  more  information,  see  TestCase
129         filter  (https://github.com/Microsoft/vstest-docs/blob/main/docs/fil
130         ter.md).
131
132--Tests <TEST_NAMES>
133
134         Run tests with names that match the provided values.  Separate multi‐
135         ple values with commas.
136
137-?|--Help
138
139         Prints out a short help for the command.
140
141@<file>
142
143         Reads response file for more options.
144
145args
146
147         Specifies  extra  arguments  to  pass  to the adapter.  Arguments are
148         specified as name-value pairs of the form <n>=<v>, where <n>  is  the
149         argument name and <v> is the argument value.  Use a space to separate
150         multiple arguments.
151

EXAMPLES

153       Run tests in mytestproject.dll:
154
155              dotnet vstest mytestproject.dll
156
157       Run tests in mytestproject.dll, exporting to custom folder with  custom
158       name:
159
160              dotnet vstest mytestproject.dll --logger:"trx;LogFileName=custom_file_name.trx" --ResultsDirectory:custom/file/path
161
162       Run tests in mytestproject.dll and myothertestproject.exe:
163
164              dotnet vstest mytestproject.dll myothertestproject.exe
165
166       Run TestMethod1 tests:
167
168              dotnet vstest /Tests:TestMethod1
169
170       Run TestMethod1 and TestMethod2 tests:
171
172              dotnet vstest /Tests:TestMethod1,TestMethod2
173

SEE ALSO

175       • VSTest.Console.exe command-line options
176
177
178
179                                  2022-06-23                  dotnet-vstest(1)
Impressum