Skip to content

Commit e246ea5

Browse files
Merge pull request #45092 from dotnet/main
Merge main into live
2 parents 37dd83b + 38bff04 commit e246ea5

File tree

5 files changed

+270
-231
lines changed

5 files changed

+270
-231
lines changed

docs/ai/conceptual/evaluation-libraries.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ The evaluation libraries, which are built on top of the [Microsoft.Extensions.AI
1818

1919
## Test integration
2020

21-
The libraries are designed to integrate smoothly with existing .NET apps, allowing you to leverage existing testing infrastructures and familiar syntax to evaluate intelligent apps. You can use any test framework (for example, [MSTest](../../core/testing/index.md#mstest), [xUnit](../../core/testing/index.md#xunit), or [NUnit](../../core/testing/index.md#nunit)) and testing workflow (for example, [Test Explorer](/visualstudio/test/run-unit-tests-with-test-explorer), [dotnet test](../../core/tools/dotnet-test.md), or a CI/CD pipeline). The library also provides easy ways to do online evaluations of your application by publishing evaluation scores to telemetry and monitoring dashboards.
21+
The libraries are designed to integrate smoothly with existing .NET apps, allowing you to leverage existing testing infrastructures and familiar syntax to evaluate intelligent apps. You can use any test framework (for example, [MSTest](../../core/testing/index.md#mstest), [xUnit](../../core/testing/index.md#xunitnet), or [NUnit](../../core/testing/index.md#nunit)) and testing workflow (for example, [Test Explorer](/visualstudio/test/run-unit-tests-with-test-explorer), [dotnet test](../../core/tools/dotnet-test.md), or a CI/CD pipeline). The library also provides easy ways to do online evaluations of your application by publishing evaluation scores to telemetry and monitoring dashboards.
2222

2323
## Comprehensive evaluation metrics
2424

docs/core/testing/index.md

Lines changed: 34 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -35,47 +35,64 @@ Keep in mind there are [best practices](unit-testing-best-practices.md) for writ
3535

3636
## Testing tools
3737

38-
.NET is a multi-language development platform, and you can write various test types for [C#](../../csharp/index.yml), [F#](../../fsharp/index.yml), and [Visual Basic](../../visual-basic/index.yml). For each of these languages, you can choose between several test frameworks.
38+
When running tests in .NET, there are two components involved: the test platform and the test framework.
3939

40-
### xUnit
40+
### Test platforms
4141

42-
[xUnit](https://xunit.net) is a free, open-source, community-focused unit testing tool for .NET. The original inventor of NUnit v2 wrote xUnit.net. xUnit.net is the latest technology for unit testing .NET apps. It also works with ReSharper, CodeRush, and TestDriven.NET. xUnit.net is a project of the [.NET Foundation](https://dotnetfoundation.org) and operates under its code of conduct.
42+
The test platform is the engine that runs the tests and acts as a communication channel with IDEs. For example, Visual Studio can send a discovery request to the test platform so that it can display the available tests in Test Explorer. The test platform responds back to the IDE with the tests it found. Similar communication happens for test execution.
43+
44+
VSTest has been used for many years in .NET and was the only test platform in the ecosystem. Early in 2024, the first stable version of a new test platform, called [Microsoft.Testing.Platform (MTP)](./unit-testing-platform-intro.md), was released.
45+
46+
### Test frameworks
47+
48+
The test framework is built on top of the test platform. It defines the set of attributes and APIs that are available to you, as a test author. It's usually powered by a test adapter, which acts as a communication layer between the test framework and the test platform. The popular test frameworks are MSTest, NUnit, TUnit, and xUnit.net.
49+
50+
#### MSTest
51+
52+
[MSTest](https://github.com/microsoft/testfx) is the Microsoft test framework for all .NET languages. It's extensible and works with .NET CLI, Visual Studio, Visual Studio Code, and Rider. It supports both VSTest and Microsoft.Testing.Platform.
4353

4454
For more information, see the following resources:
4555

46-
- [Unit testing with C#](unit-testing-with-dotnet-test.md)
47-
- [Unit testing with F#](unit-testing-fsharp-with-dotnet-test.md)
48-
- [Unit testing with Visual Basic](unit-testing-visual-basic-with-dotnet-test.md)
56+
- [Microsoft.Testing.Platform support in MSTest (MSTest runner)](unit-testing-mstest-runner-intro.md)
57+
- [Unit testing with C#](unit-testing-with-mstest.md)
58+
- [Unit testing with F#](unit-testing-fsharp-with-mstest.md)
59+
- [Unit testing with Visual Basic](unit-testing-visual-basic-with-mstest.md)
4960

50-
### NUnit
61+
#### NUnit
5162

52-
[NUnit](https://nunit.org) is a unit-testing framework for all .NET languages. Initially, NUnit was ported from JUnit, and the current production release has been rewritten with many new features and support for a wide range of .NET platforms. It's a project of the [.NET Foundation](https://dotnetfoundation.org).
63+
[NUnit](https://nunit.org) is a unit-testing framework for all .NET languages. Initially, NUnit was ported from JUnit, and the current production release has been rewritten with many new features and support for a wide range of .NET platforms. It's a project of the [.NET Foundation](https://dotnetfoundation.org). It supports both VSTest and Microsoft.Testing.Platform.
5364

5465
For more information, see the following resources:
5566

67+
- [Microsoft.Testing.Platform support in NUnit (NUnit runner)](unit-testing-nunit-runner-intro.md)
5668
- [Unit testing with C#](unit-testing-with-nunit.md)
5769
- [Unit testing with F#](unit-testing-fsharp-with-nunit.md)
5870
- [Unit testing with Visual Basic](unit-testing-visual-basic-with-nunit.md)
5971

60-
### MSTest
72+
#### TUnit
6173

62-
[MSTest](https://github.com/microsoft/testfx) is the Microsoft test framework for all .NET languages. It's extensible and works with both .NET CLI and Visual Studio. For more information, see the following resources:
74+
[TUnit](https://thomhurst.github.io/TUnit/) is entirely built on top of Microsoft.Testing.Platform and doesn't support VSTest. For more information, refer to TUnit documentation.
6375

64-
- [Unit testing with C#](unit-testing-with-mstest.md)
65-
- [Unit testing with F#](unit-testing-fsharp-with-mstest.md)
66-
- [Unit testing with Visual Basic](unit-testing-visual-basic-with-mstest.md)
76+
#### xUnit.net
77+
78+
[xUnit.net](https://xunit.net) is a free, open-source, community-focused unit testing tool for .NET. The original inventor of NUnit v2 wrote xUnit.net. xUnit.net is the latest technology for unit testing .NET apps. It also works with ReSharper, CodeRush, and TestDriven.NET. xUnit.net is a project of the [.NET Foundation](https://dotnetfoundation.org) and operates under its code of conduct. It supports both VSTest and Microsoft.Testing.Platform
6779

68-
#### MSTest runner
80+
For more information, see the following resources:
81+
82+
- [Microsoft.Testing.Platform support in xUnit.net v3](https://xunit.net/docs/getting-started/v3/microsoft-testing-platform)
83+
- [Unit testing with C#](unit-testing-with-dotnet-test.md)
84+
- [Unit testing with F#](unit-testing-fsharp-with-dotnet-test.md)
85+
- [Unit testing with Visual Basic](unit-testing-visual-basic-with-dotnet-test.md)
6986

70-
The MSTest runner is a lightweight and portable alternative to [VSTest](https://github.com/microsoft/vstest) for running tests in continuous integration (CI) pipelines, and in Visual Studio Test Explorer. For more information, see [MSTest runner overview](unit-testing-mstest-runner-intro.md).
87+
## Running tests
7188

7289
### .NET CLI
7390

74-
You can run a solutions unit test from the [.NET CLI](../tools/index.md) with the [dotnet test](../tools/dotnet-test.md) command. The .NET CLI exposes most of the functionality that [Integrated Development Environments (IDEs)](#ide) make available through user interfaces. The .NET CLI is cross-platform and available to use as part of continuous integration and delivery pipelines. The .NET CLI is used with scripted processes to automate common tasks.
91+
You can run unit tests from all test projects in a solution using the [.NET CLI](../tools/index.md) with the [dotnet test](../tools/dotnet-test.md) command. The .NET CLI exposes most of the functionality that [Integrated Development Environments (IDEs)](#ide) make available through user interfaces. The .NET CLI is cross-platform and available to use as part of continuous integration and delivery pipelines. The .NET CLI is used with scripted processes to automate common tasks.
7592

7693
### IDE
7794

78-
Whether you're using Visual Studio or Visual Studio Code, there are graphical user interfaces for testing functionality. There are more features available to IDEs than the CLI, for example, [Live Unit Testing](/visualstudio/test/live-unit-testing). For more information, see [Including and excluding tests with Visual Studio](/visualstudio/test/live-unit-testing#include-and-exclude-test-projects-and-test-methods).
95+
Whether you're using Visual Studio, Visual Studio Code, or Rider, there are graphical user interfaces for testing functionality. There are more features available to IDEs than the CLI, for example, [Live Unit Testing](/visualstudio/test/live-unit-testing). For more information, see [Including and excluding tests with Visual Studio](/visualstudio/test/live-unit-testing#include-and-exclude-test-projects-and-test-methods).
7996

8097
## See also
8198

docs/core/testing/unit-testing-mstest-runner-intro.md

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
---
2-
title: MSTest runner overview
2+
title: Microsoft.Testing.Platform support in MSTest (MSTest runner)
33
description: Learn about the MSTest runner, a lightweight way to run tests without depending on the .NET SDK.
44
author: nohwnd
55
ms.author: jajares
66
ms.date: 12/15/2023
77
---
88

9-
# MSTest runner overview
9+
# Microsoft.Testing.Platform support in MSTest (MSTest runner)
1010

11-
The MSTest runner is a lightweight and portable alternative to [VSTest](https://github.com/microsoft/vstest) for running tests in all contexts (for example, continuous integration (CI) pipelines, CLI, Visual Studio Test Explorer, and VS Code Test Explorer). The MSTest runner is embedded directly in your MSTest test projects, and there are no other app dependencies, such as `vstest.console` or `dotnet test`, needed to run your tests.
11+
MSTest supports running tests with both VSTest and [Microsoft.Testing.Platform (MTP)](./unit-testing-platform-intro.md). The support for MTP is powered by the MSTest runner, which can run tests in all contexts (for example, continuous integration (CI) pipelines, CLI, Visual Studio Test Explorer, and VS Code Text Explorer). The MSTest runner is embedded directly in your MSTest test projects, and there are no other app dependencies, such as `vstest.console` or `dotnet test`, needed to run your tests. However, you can still run your tests using `dotnet test`.
1212

13-
The MSTest runner is open source, and builds on a [`Microsoft.Testing.Platform`](./unit-testing-platform-intro.md) library. You can find `Microsoft.Testing.Platform` code in [microsoft/testfx](https://github.com/microsoft/testfx/tree/main/src/Platform/Microsoft.Testing.Platform) GitHub repository. The MSTest runner comes bundled with `MSTest in 3.2.0-preview.23623.1` or newer.
13+
The MSTest runner is open source and builds on the [`Microsoft.Testing.Platform`](./unit-testing-platform-intro.md) library. You can find `Microsoft.Testing.Platform` code in the [microsoft/testfx](https://github.com/microsoft/testfx/tree/main/src/Platform/Microsoft.Testing.Platform) GitHub repository. The MSTest runner comes bundled with `MSTest in 3.2.0` or newer.
1414

1515
## Enable MSTest runner in an MSTest project
1616

@@ -19,7 +19,7 @@ It's recommended to use [MSTest SDK](./unit-testing-mstest-sdk.md) as it greatly
1919
When you use `MSTest SDK`, by default you're opted in to using MSTest runner.
2020

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

2424
<PropertyGroup>
2525
<TargetFramework>net8.0</TargetFramework>
@@ -30,7 +30,7 @@ When you use `MSTest SDK`, by default you're opted in to using MSTest runner.
3030
</Project>
3131
```
3232

33-
Alternatively, you can enable MSTest runner by adding the `EnableMSTestRunner` property and setting `OutputType` to `Exe` in your project file. You also need to ensure that you're using `MSTest 3.2.0-preview.23623.1` or newer.
33+
Alternatively, you can enable MSTest runner by adding the `EnableMSTestRunner` property and setting `OutputType` to `Exe` in your project file. You also need to ensure that you're using `MSTest 3.2.0` or newer. We strongly recommend you update to the latest MSTest version available.
3434

3535
Consider the following example project file:
3636

@@ -40,14 +40,19 @@ Consider the following example project file:
4040
<PropertyGroup>
4141
<!-- Enable the MSTest runner, this is an opt-in feature -->
4242
<EnableMSTestRunner>true</EnableMSTestRunner>
43+
<TestingPlatformDotnetTestSupport>true</TestingPlatformDotnetTestSupport>
44+
45+
<!--
46+
Displays error on console in addition to the log file. Note that this feature comes with a performance impact.
47+
For more information, visit https://learn.microsoft.com/dotnet/core/testing/unit-testing-platform-integration-dotnet-test#show-failure-per-test
48+
-->
49+
<TestingPlatformShowTestsFailure>true</TestingPlatformShowTestsFailure>
50+
4351
<OutputType>Exe</OutputType>
4452

4553
<TargetFramework>net8.0</TargetFramework>
4654
<ImplicitUsings>enable</ImplicitUsings>
4755
<Nullable>enable</Nullable>
48-
49-
<IsPackable>false</IsPackable>
50-
<IsTestProject>true</IsTestProject>
5156
</PropertyGroup>
5257

5358
<ItemGroup>
@@ -58,8 +63,11 @@ Consider the following example project file:
5863
MSTest.TestAdapter
5964
MSTest.TestFramework
6065
MSTest.Analyzers
66+
Starting with 3.8, it also includes:
67+
Microsoft.Testing.Extensions.TrxReport
68+
Microsoft.Testing.Extensions.CodeCoverage
6169
-->
62-
<PackageReference Include="MSTest" Version="3.2.0" />
70+
<PackageReference Include="MSTest" Version="3.8.0" />
6371

6472
<!--
6573
Coverlet collector isn't compatible with MSTest runner, you can
@@ -75,7 +83,7 @@ Consider the following example project file:
7583
```
7684

7785
> [!TIP]
78-
> It's advised to set the `EnableMSTestRunner` property in *Directory.Build.props* file instead of *csproj* file to ensure all test projects in your solution are using the MSTest runner.
86+
> To ensure all test projects in your solution use the MSTest runner, set the `EnableMSTestRunner` and `TestingPlatformDotnetTestSupport` properties in *Directory.Build.props* file instead of individual project files.
7987
8088
## Configurations and filters
8189

docs/core/testing/unit-testing-nunit-runner-intro.md

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
11
---
2-
title: NUnit runner overview
2+
title: Microsoft.Testing.Platform support in NUnit (NUnit runner)
33
description: Learn about the NUnit runner, a lightweight way to run tests without depending on the .NET SDK.
44
author: Evangelink
55
ms.author: amauryleve
66
ms.date: 05/21/2024
77
---
88

9-
# NUnit runner overview
9+
# Microsoft.Testing.Platform support in NUnit (NUnit runner)
1010

11-
The NUnit runner is a lightweight and portable alternative to [VSTest](https://github.com/microsoft/vstest) for running tests in all contexts (for example, continuous integration (CI) pipelines, CLI, Visual Studio Test Explorer, and VS Code Text Explorer). The NUnit runner is embedded directly in your NUnit test projects, and there are no other app dependencies, such as `vstest.console` or `dotnet test`, needed to run your tests.
11+
NUnit supports running tests with both VSTest and [Microsoft.Testing.Platform (MTP)](./unit-testing-platform-intro.md). The support for MTP is powered by the NUnit runner, which can run tests in all contexts (for example, continuous integration (CI) pipelines, CLI, Visual Studio Test Explorer, and VS Code Text Explorer). The NUnit runner is embedded directly in your NUnit test projects, and there are no other app dependencies, such as `vstest.console` or `dotnet test`, needed to run your tests. However, you can still run your tests using `dotnet test`.
1212

13-
The NUnit runner is open source, and builds on a [`Microsoft.Testing.Platform`](./unit-testing-platform-intro.md) library. You can find `Microsoft.Testing.Platform` code in [microsoft/testfx](https://github.com/microsoft/testfx/tree/main/src/Platform/Microsoft.Testing.Platform) GitHub repository. The NUnit runner comes bundled with `NUnit 5.0.0-beta.2` or newer.
13+
The NUnit runner is open source, and builds on top of [`Microsoft.Testing.Platform`](./unit-testing-platform-intro.md). You can find `Microsoft.Testing.Platform` code in [microsoft/testfx](https://github.com/microsoft/testfx/tree/main/src/Platform/Microsoft.Testing.Platform) GitHub repository. The NUnit runner is supported in NUnit3TestAdapter version 5.0 or greater. For more information, see [NUnit and Microsoft.Testing.Platform](https://docs.nunit.org/articles/vs-test-adapter/NUnit-And-Microsoft-Test-Platform.html)
1414

1515
## Enable NUnit runner in a NUnit project
1616

17-
You can enable NUnit runner by adding the `EnableNUnitRunner` property and setting `OutputType` to `Exe` in your project file. You also need to ensure that you're using `NUnit 5.0.0-beta.2` or newer.
17+
You can enable NUnit runner by adding the `EnableNUnitRunner` property and setting `OutputType` to `Exe` in your project file. You also need to ensure that you're using `NUnit3TestAdapter` version 5.0 or newer.
18+
19+
> [!TIP]
20+
> To ensure all test projects in your solution use the NUnit runner, set the `EnableNUnitRunner` and `TestingPlatformDotnetTestSupport` properties in *Directory.Build.props* file instead of individual project files.
1821
1922
Consider the following example project file:
2023

@@ -24,24 +27,29 @@ Consider the following example project file:
2427
<PropertyGroup>
2528
<!-- Enable the NUnit runner, this is an opt-in feature -->
2629
<EnableNUnitRunner>true</EnableNUnitRunner>
30+
<TestingPlatformDotnetTestSupport>true</TestingPlatformDotnetTestSupport>
31+
32+
<!--
33+
Displays error on console in addition to the log file. Note that this feature comes with a performance impact.
34+
For more information, visit https://learn.microsoft.com/dotnet/core/testing/unit-testing-platform-integration-dotnet-test#show-failure-per-test
35+
-->
36+
<TestingPlatformShowTestsFailure>true</TestingPlatformShowTestsFailure>
37+
2738
<OutputType>Exe</OutputType>
2839

2940
<TargetFramework>net8.0</TargetFramework>
3041
<ImplicitUsings>enable</ImplicitUsings>
3142
<Nullable>enable</Nullable>
32-
33-
<IsPackable>false</IsPackable>
34-
<IsTestProject>true</IsTestProject>
3543
</PropertyGroup>
3644

3745
<ItemGroup>
3846
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
39-
<PackageReference Include="NUnit" Version="4.1.0" />
40-
<PackageReference Include="NUnit.Analyzers" Version="4.2.0">
47+
<PackageReference Include="NUnit" Version="4.3.2" />
48+
<PackageReference Include="NUnit.Analyzers" Version="4.6.0">
4149
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
4250
<PrivateAssets>all</PrivateAssets>
4351
</PackageReference>
44-
<PackageReference Include="NUnit3TestAdapter" Version="5.0.0-beta.2" />
52+
<PackageReference Include="NUnit3TestAdapter" Version="5.0.0" />
4553

4654
<!--
4755
Coverlet collector isn't compatible with NUnit runner, you can

0 commit comments

Comments
 (0)