Skip to content

Commit 2c4dba6

Browse files
authored
Update MSTest version in MSTest SDK doc (#45625)
1 parent cfa3933 commit 2c4dba6

File tree

1 file changed

+16
-30
lines changed

1 file changed

+16
-30
lines changed

docs/core/testing/unit-testing-mstest-sdk.md

Lines changed: 16 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -8,41 +8,37 @@ ms.date: 02/13/2024
88

99
# MSTest SDK overview
1010

11-
[MSTest.Sdk](https://www.nuget.org/packages/MSTest.Sdk) is a [MSBuild project SDK](/visualstudio/msbuild/how-to-use-project-sdk) for building MSTest apps. It's possible to build a MSTest app without this SDK, however, the MSTest SDK is:
11+
[MSTest.Sdk](https://www.nuget.org/packages/MSTest.Sdk) is an [MSBuild project SDK](/visualstudio/msbuild/how-to-use-project-sdk) for building MSTest apps. It's possible to build a MSTest app without this SDK, however, the MSTest SDK is:
1212

1313
* Tailored towards providing a first-class experience for testing with MSTest.
1414
* The recommended target for most users.
1515
* Easy to configure for other users.
1616

17-
The MSTest SDK discovers and runs your tests using the [MSTest runner](./unit-testing-mstest-runner-intro.md).
17+
By default, the MSTest SDK discovers and runs your tests using the [MSTest runner for Microsoft.Testing.Platform](./unit-testing-mstest-runner-intro.md). You can switch to using VSTest by specifying `<UseVSTest>true</UseVSTest>`
1818

1919
You can enable `MSTest.Sdk` in a project by simply updating the `Sdk` attribute of the `Project` node of your project:
2020

2121
```xml
22-
<Project Sdk="MSTest.Sdk/3.6.3">
22+
<Project Sdk="MSTest.Sdk/3.8.3">
2323

24-
<PropertyGroup>
25-
<TargetFramework>net8.0</TargetFramework>
26-
</PropertyGroup>
27-
28-
<!-- references to the code to test -->
24+
<PropertyGroup>
25+
<TargetFramework>net8.0</TargetFramework>
26+
</PropertyGroup>
2927

3028
</Project>
3129
```
3230

3331
> [!NOTE]
34-
> `/3.6.3` is given as example and can be replaced with any newer version.
32+
> `/3.8.3` is given as example and can be replaced with any newer version.
3533
3634
To simplify handling of versions, we recommend setting the SDK version at solution level using the _global.json_ file. For example, your project file would look like:
3735

3836
```xml
3937
<Project Sdk="MSTest.Sdk">
4038

41-
<PropertyGroup>
42-
<TargetFramework>net8.0</TargetFramework>
43-
</PropertyGroup>
44-
45-
<!-- references to the code to test -->
39+
<PropertyGroup>
40+
<TargetFramework>net8.0</TargetFramework>
41+
</PropertyGroup>
4642

4743
</Project>
4844
```
@@ -52,7 +48,7 @@ Then, specify the `MSTest.Sdk` version in the _global.json_ file as follows:
5248
```json
5349
{
5450
"msbuild-sdks": {
55-
"MSTest.Sdk": "3.6.3"
51+
"MSTest.Sdk": "3.8.3"
5652
}
5753
}
5854
```
@@ -115,15 +111,13 @@ You can set the profile using the property `TestingExtensionsProfile` with one o
115111
Here's a full example, using the `None` profile:
116112

117113
```xml
118-
<Project Sdk="MSTest.Sdk/3.6.3">
114+
<Project Sdk="MSTest.Sdk/3.8.3">
119115

120116
<PropertyGroup>
121117
<TargetFramework>net8.0</TargetFramework>
122118
<TestingExtensionsProfile>None</TestingExtensionsProfile>
123119
</PropertyGroup>
124120

125-
<!-- references to the code to test -->
126-
127121
</Project>
128122
```
129123

@@ -144,15 +138,13 @@ Extensions can be enabled and disabled by MSBuild properties with the pattern `E
144138
For example, to enable the crash dump extension (NuGet package [Microsoft.Testing.Extensions.CrashDump](https://www.nuget.org/packages/Microsoft.Testing.Extensions.CrashDump)), you can use the following property `EnableMicrosoftTestingExtensionsCrashDump` set to `true`:
145139

146140
```xml
147-
<Project Sdk="MSTest.Sdk/3.6.3">
141+
<Project Sdk="MSTest.Sdk/3.8.3">
148142

149143
<PropertyGroup>
150144
<TargetFramework>net8.0</TargetFramework>
151145
<EnableMicrosoftTestingExtensionsCrashDump>true</EnableMicrosoftTestingExtensionsCrashDump>
152146
</PropertyGroup>
153147

154-
<!-- references to the code to test -->
155-
156148
</Project>
157149
```
158150

@@ -168,15 +160,13 @@ This property pattern can be used to enable an additional extension on top of th
168160
You can also disable an extension that's coming from the selected profile. For example, disable the `MS Code Coverage` extension by setting `<EnableMicrosoftTestingExtensionsCodeCoverage>false</EnableMicrosoftTestingExtensionsCodeCoverage>`:
169161

170162
```xml
171-
<Project Sdk="MSTest.Sdk/3.6.3">
163+
<Project Sdk="MSTest.Sdk/3.8.3">
172164

173165
<PropertyGroup>
174166
<TargetFramework>net8.0</TargetFramework>
175167
<EnableMicrosoftTestingExtensionsCodeCoverage>false</EnableMicrosoftTestingExtensionsCodeCoverage>
176168
</PropertyGroup>
177169

178-
<!-- references to the code to test -->
179-
180170
</Project>
181171
```
182172

@@ -201,8 +191,6 @@ By setting the property `EnableAspireTesting` to `true`, you can bring all depen
201191
<EnableAspireTesting>true</EnableAspireTesting>
202192
</PropertyGroup>
203193

204-
<!-- references to the code to test -->
205-
206194
</Project>
207195
```
208196

@@ -223,8 +211,6 @@ By setting the property `EnablePlaywright` to `true` you can bring in all the de
223211
<EnablePlaywright>true</EnablePlaywright>
224212
</PropertyGroup>
225213

226-
<!-- references to the code to test -->
227-
228214
</Project>
229215
```
230216

@@ -246,7 +232,7 @@ Add the version to your `global.json`:
246232
```json
247233
{
248234
"msbuild-sdks": {
249-
"MSTest.Sdk": "3.6.3"
235+
"MSTest.Sdk": "3.8.3"
250236
}
251237
}
252238
```
@@ -286,7 +272,7 @@ If you are using the VSTest mode of `dotnet test`, here's an example update when
286272
command: 'test'
287273
projects: '**/**.sln'
288274
- arguments: '--configuration Release'
289-
+ arguments: '--configuration Release -p:TestingPlatformCommandLineArguments="--report-trx --results-directory $(Agent.TempDirectory) --coverage"'
275+
+ arguments: '--configuration Release -- --report-trx --results-directory $(Agent.TempDirectory) --coverage'
290276
```
291277

292278
## Known limitations

0 commit comments

Comments
 (0)