-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Update MSTest v4 migration documentation #50543
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,7 +3,7 @@ title: MSTest migration from v3 to v4 | |
| description: Learn about migrating to MSTest v4. | ||
| author: Youssef1313 | ||
| ms.author: ygerges | ||
| ms.date: 07/22/2025 | ||
| ms.date: 12/11/2025 | ||
| --- | ||
|
|
||
| # Migrate from MSTest v3 to v4 | ||
|
|
@@ -99,6 +99,20 @@ public static void ClassCleanup(TestContext testContext) | |
|
|
||
| Previously, `TestContext.Properties` was an `IDictionary`. To provide better typing, it's now `IDictionary<string, object>`. | ||
|
|
||
| #### Accessing non-existing property | ||
|
|
||
| Accessing a non-existing property in the dictionary will now throw `KeyNotFoundException` rather than returning null. | ||
|
||
|
|
||
| ```csharp | ||
| // in MSTest 3.x | ||
| var value = TestContext.Properties["NonExistent"]; // Returns null | ||
|
|
||
| // in MSTest 4.x | ||
| var value = TestContext.Properties["NonExistent"]; // Throws KeyNotFoundException | ||
| ``` | ||
|
|
||
| To check for existence of a property, use `TryGetValue` or `ContainsKey` methods. | ||
|
||
|
|
||
| If you have calls to `TestContext.Properties.Contains`, update them to `TestContext.Properties.ContainsKey`. | ||
|
|
||
| ### TestTimeout enum is removed | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The heading uses a gerund "Accessing", which should be avoided in titles. Consider changing this to a noun-based heading such as "Access to non-existing properties" or "Non-existing property access".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot open a new pull request to apply changes based on this feedback