You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/core/testing/unit-testing-mstest-configure.md
+107-7Lines changed: 107 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -117,35 +117,97 @@ MSTest settings are grouped by functionality that are described in the sections
117
117
| enableBaseClassTestMethodsFromOtherAssemblies | true | A value indicating whether to enable discovery of test methods from base classes in a different assembly from the inheriting test class. |
118
118
| classCleanupLifecycle | EndOfAssembly | If you want the class cleanup to occur at the end of the class, set it to **EndOfClass**. |
119
119
120
-
#### AssemblyResolution settings
120
+
#### `assemblyResolution` settings
121
+
122
+
All the settings in this section belong to the `assemblyResolution` element.
121
123
122
124
| Entry | Default | Description |
123
125
|-------|---------|-------------|
124
126
| paths | None | You can specify paths to extra assemblies when finding and running unit tests. For example, use these paths for dependency assemblies that aren't in the same directory as the test assembly. You can specify a path in the shape `{ "path": "...", "includeSubDirectories": "true/false" }`. |
All the settings in this section belong to the `deployment` element.
127
143
128
144
| Entry | Default | Description |
129
145
|-------|---------|-------------|
130
146
| deleteDeploymentDirectoryAfterTestRunIsComplete | true | To retain the deployment directory after a test run, set this value to **false**. |
131
147
| deployTestSourceDependencies | true | Indicates whether the test source references are to be deployed. |
132
148
| enabled | true | If you set the value to **false**, deployment items that you specify in your test method aren't copied to the deployment directory. |
All the settings in this section belong to the `output` element.
135
167
136
168
| Entry | Default | Description |
137
169
|-------|---------|-------------|
138
-
| captureTrace | false | Capture text messages coming from the `Console.Write*`, `Trace.Write*`, and `Debug.Write*` APIs that will be associated to the current running test. |
170
+
| captureTrace | true | Capture text messages coming from the `Console.Write*`, `Trace.Write*`, and `Debug.Write*` APIs that will be associated to the current running test. |
171
+
172
+
Example:
173
+
174
+
```json
175
+
{
176
+
"mstest": {
177
+
"output": {
178
+
"captureTrace": false
179
+
}
180
+
}
181
+
}
182
+
```
183
+
184
+
#### `parallelism` settings
139
185
140
-
#### Parallelism settings
186
+
All the settings in this section belong to the `parallelism` element.
141
187
142
188
| Entry | Default | Description |
143
189
|-------|---------|-------------|
144
190
| enabled | false | Enable test parallelization. |
145
191
| scope | class | The scope of parallelization. You can set it to `method`. The default, `class`, corresponds to running all tests of a given class sequentially but multiple classes in parallel. |
146
192
| workers | 0 | The number of threads/workers to be used for parallelization. The default value maps to the number of processors on the current machine. |
147
193
148
-
#### Execution settings
194
+
Example:
195
+
196
+
```json
197
+
{
198
+
"mstest": {
199
+
"parallelism": {
200
+
"enabled": true,
201
+
"scope": "method",
202
+
"workers": 32
203
+
}
204
+
}
205
+
}
206
+
```
207
+
208
+
#### `execution` settings
209
+
210
+
All the settings in this section belong to the `execution` element.
149
211
150
212
| Entry | Default | Description |
151
213
|-------|---------|-------------|
@@ -156,7 +218,26 @@ MSTest settings are grouped by functionality that are described in the sections
156
218
| treatClassAndAssemblyCleanupWarningsAsErrors | false | To see your failures in class cleanups as errors, set this value to **true**. |
157
219
| treatDiscoveryWarningsAsErrors | false | To report test discovery warnings as errors, set this value to **true**. |
All the settings in this section belong to the `timeout` element.
160
241
161
242
| Entry | Default | Description |
162
243
|-------|---------|-------------|
@@ -172,6 +253,25 @@ MSTest settings are grouped by functionality that are described in the sections
172
253
> [!NOTE]
173
254
> `[Timeout]` attribute specified on a method overrides the global timeout. For example, `[Timeout(1000)]` on a method marked with [AssemblyCleanup] will override the global `assemblyCleanup` timeout.
174
255
256
+
Example:
257
+
258
+
```json
259
+
{
260
+
"mstest": {
261
+
"timeout": {
262
+
"assemblyCleanup": 0,
263
+
"assemblyInitialize": 0,
264
+
"classCleanup": 0,
265
+
"classInitialize": 0,
266
+
"test": 0,
267
+
"testCleanup": 0,
268
+
"testInitialize": 0,
269
+
"useCooperativeCancellation": false
270
+
}
271
+
}
272
+
}
273
+
```
274
+
175
275
### Example *testconfig.json* file
176
276
177
277
The following JSON shows the contents of a typical *.testconfig.json* file. Copy this code and edit it to suit your needs.
0 commit comments