Skip to content

Commit ae829f7

Browse files
committed
Updated /docs/getting-started/v3/microsoft-testing-platform with info for .NET 10 SDK
1 parent 894d9de commit ae829f7

File tree

3 files changed

+60
-4
lines changed

3 files changed

+60
-4
lines changed

.github/workflows/push-main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
uses: actions/setup-dotnet@v4
2626
with:
2727
dotnet-version: |
28-
9.0.x
28+
10.0.x
2929
3030
- name: Get .NET information
3131
run: dotnet --info

global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"sdk": {
3-
"version": "9.0.100",
3+
"version": "10.0.100",
44
"rollForward": "latestMinor"
55
}
66
}

site/docs/getting-started/v3/microsoft-testing-platform.md

Lines changed: 58 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,11 @@ Test summary: total: 5, failed: 2, succeeded: 3, skipped: 0, duration: 0.7s
281281
Build failed with 2 error(s) in 1.2s
282282
```
283283

284-
To enable MTP compatibility with the VSTest mode of `dotnet test`, add the following property to your project file (.csproj/.fsproj/.vbproj):
284+
The way you enable MTP mode for `dotnet test` varies depending on what version of the .NET SDK you're using (meaning the version number that's printed when you run `dotnet --version` from your project folder).
285+
286+
### Using .NET SDK version 8 or 9
287+
288+
To enable `dotnet test` to run your tests using MTP instead of VSTest, add the following property to your project file (.csproj/.fsproj/.vbproj):
285289

286290
```xml
287291
<PropertyGroup>
@@ -329,7 +333,59 @@ Test run summary: Failed! - bin\Debug\net8.0\MyFirstUnitTests.dll (net8.0|x64)
329333
bin\Debug\net8.0\MyFirstUnitTests.exe --internal-msbuild-node testingplatform.pipe.b1e011b9ecd145c696246de44d7af67c
330334
```
331335

332-
The same command line options available in the Microsoft Testing Platform command line experience (described in the table above) are also available for `dotnet test`. The command line options are passed after `--`. For example, to filter tests to a single class with the Microsoft Testing Platform `dotnet test` experience, you could run: `dotnet test -- --filter-class ClassName`. This includes command line options from any [Microsoft Testing Platform features](#additional-microsoft-testing-platform-features) you may add. _**Note:** These command line options are available for `dotnet test` regardless of whether you enable the Microsoft Testing Platform command line experience._
336+
The same command line options available in the Microsoft Testing Platform command line experience (described in the table above) are also available for `dotnet test`. The command line options are passed after `--`. For example, to filter tests to a single class with the Microsoft Testing Platform `dotnet test` experience, you could run: `dotnet test -- --filter-class ClassName`. This includes command line options from any [Microsoft Testing Platform features](#additional-microsoft-testing-platform-features) you may add.
337+
338+
You can find additional configuration options for the Microsoft Testing Platform `dotnet test` integration here: [Microsoft.Testing.Platform mode of `dotnet test`](https://learn.microsoft.com/dotnet/core/testing/unit-testing-with-dotnet-test#microsofttestingplatform-mtp-mode-of-dotnet-test)
339+
340+
### Using .NET SDK version 10 or later
341+
342+
To enable `dotnet test` to run your tests using MTP instead of VSTest, add/edit the `global.json` file in the root of your solution with the following value:
343+
344+
```json
345+
{
346+
"test": {
347+
"runner": "Microsoft.Testing.Platform"
348+
}
349+
}
350+
```
351+
352+
Now when running `dotnet test`, your output should looks something like this:
353+
354+
```shell
355+
$ dotnet test
356+
Running tests from bin\Debug\net8.0\MyFirstUnitTests.dll (net8.0|x64)
357+
failed MyFirstUnitTests.UnitTest1.FailingTest (8ms)
358+
Assert.Equal() Failure: Values differ
359+
Expected: 5
360+
Actual: 4
361+
from bin\Debug\net8.0\MyFirstUnitTests.dll (net8.0|x64)
362+
Assert.Equal() Failure: Values differ
363+
Expected: 5
364+
Actual: 4
365+
at MyFirstUnitTests.UnitTest1.FailingTest() in UnitTest1.cs:14
366+
failed MyFirstUnitTests.UnitTest1.MyFirstTheory(value: 6) (0ms)
367+
Assert.True() Failure
368+
Expected: True
369+
Actual: False
370+
from bin\Debug\net8.0\MyFirstUnitTests.dll (net8.0|x64)
371+
Assert.True() Failure
372+
Expected: True
373+
Actual: False
374+
at MyFirstUnitTests.UnitTest1.MyFirstTheory(Int32 value) in UnitTest1.cs:28
375+
bin\Debug\net8.0\MyFirstUnitTests.dll (net8.0|x64) failed with 2 error(s) (158ms)
376+
Exit code: 2
377+
Standard output: xUnit.net v3 Microsoft.Testing.Platform Runner v3.1.0+03a071627b (64-bit .NET 8.0.22)
378+
379+
Test run summary: Failed!
380+
total: 5
381+
failed: 2
382+
succeeded: 3
383+
skipped: 0
384+
duration: 254ms
385+
Test run completed with non-success exit code: 2 (see: https://aka.ms/testingplatform/exitcodes)
386+
```
387+
388+
The same command line options available in the Microsoft Testing Platform command line experience (described in the table above) are also available for `dotnet test`. For example, to filter tests to a single class with the Microsoft Testing Platform `dotnet test` experience, you could run: `dotnet test --filter-class ClassName`. Typing `dotnet test -?` from within your project folder will list all the available options (including built-in options, options provided by xUnit.net, and options from any [Microsoft Testing Platform features](#additional-microsoft-testing-platform-features) you have added).
333389

334390
You can find additional configuration options for the Microsoft Testing Platform `dotnet test` integration here: [Microsoft.Testing.Platform mode of `dotnet test`](https://learn.microsoft.com/dotnet/core/testing/unit-testing-with-dotnet-test#microsofttestingplatform-mtp-mode-of-dotnet-test)
335391

0 commit comments

Comments
 (0)