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-migration-from-v1-to-v3.md
+7Lines changed: 7 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,6 +9,7 @@ ms.date: 11/06/2024
9
9
# MSTest v3 migration guide
10
10
11
11
This guide assists users in upgrading their MSTest projects from MSTest v1 to MSTest v3. MSTest v3 introduces significant new features, optimizations, and some breaking changes to improve test reliability, execution speed, and compatibility with modern .NET frameworks.
12
+
12
13
### Who is impacted?
13
14
14
15
This guide is intended for projects currently **.NET Framework projects** using MSTest v1 via either:
@@ -17,6 +18,7 @@ This guide is intended for projects currently **.NET Framework projects** using
17
18
-**NuGet packages**: Projects using `MSTest.TestFramework` NuGet package with version 1.0.0-1.4.0.
18
19
19
20
If your project relies on MSTest for unit testing and includes the above references, it will benefit from the improvements in MSTest v3 and requires adjustments outlined in this guide.
21
+
20
22
### Why migrate to MSTest v3?
21
23
22
24
Even if you’re satisfied with your current MSTest setup, upgrading to MSTest v3 unlocks substantial advantages that improve both the quality and future-readiness of your tests. Here’s why making the switch now can be a valuable step forward:
@@ -35,6 +37,7 @@ Even if you’re satisfied with your current MSTest setup, upgrading to MSTest v
35
37
-**Greater Flexibility and Extensibility**: MSTest v3 supports advanced testing scenarios, including dynamic data sources and in-assembly parallel execution. This flexibility enables more sophisticated testing approaches and speeds up test suites without complex configurations.
36
38
37
39
By upgrading, you’re setting up your tests to be faster, more reliable, and adaptable to future .NET developments, positioning your project for long-term success and easier maintenance.
40
+
38
41
## Migration steps
39
42
40
43
### 1. Remove assembly reference
@@ -99,6 +102,7 @@ Choose the option that best suits your project setup. Both methods ensure your p
99
102
- **Test Initialization**: Use `TestInitialize` methods for async initialization.
100
103
- **Cleanup**: Use `TestCleanup` methods or the `Dispose` pattern for cleanup.
101
104
- **RunSettings**: The `.testsettings` file is no longer supported, meaning `<LegacySettings>` is also no longer available. Use [.runsettings](/visualstudio/test/configure-unit-tests-by-using-a-dot-runsettings-file) fortest configuration.
105
+
102
106
## New Features in MSTest v3
103
107
104
108
- Improved defaults fortest projects
@@ -108,6 +112,7 @@ Choose the option that best suits your project setup. Both methods ensure your p
108
112
- Support for WinUI applications
109
113
- In-assembly parallel execution
110
114
- Dynamic data sources for data-driven tests
115
+
111
116
## Deprecated Features
112
117
113
118
- Dropped support for:
@@ -116,6 +121,7 @@ Choose the option that best suits your project setup. Both methods ensure your p
116
121
- **UWP versions before 16299**
117
122
- **WinUI versions before 18362**
118
123
- **.NET 5** (use .NET Core 3.1 or .NET 6)
124
+
119
125
## Breaking Changes and Removed APIs
120
126
121
127
### Assertion overloads
@@ -162,6 +168,7 @@ public void TestMethod() { ... }
162
168
[Timeout(2000)] // Verify this value still works under MSTest v3
163
169
public async Task TestMethod() { ... }
164
170
```
171
+
165
172
## Configuration changes
166
173
MSTest v3 supports both XML and JSON formats for configuration files.
0 commit comments