Skip to content

Commit 23892dc

Browse files
authored
Update unit-testing-mstest-migration-from-v1-to-v3.md
1 parent ee17725 commit 23892dc

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

docs/core/testing/unit-testing-mstest-migration-from-v1-to-v3.md

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,29 @@ public void MyTestMethod(int number, string text) { ... }
186186
187187
### Timeout Settings
188188
189-
Timeout settings are standardized across frameworks in MSTest v3. Verify and adjust any timeout configurations in existing tests for compatibility.
189+
In MSTest v3, the handling of `Timeout` settings has been standardized to ensure consistent behavior across different .NET environments. This change may impact tests that rely on specific timeout values, especially if those tests are asynchronous or run under different frameworks.
190+
191+
- In MSTest v1 or v2, certain timeout settings might have been interpreted differently depending on the framework (e.g., .NET Framework vs. .NET Core).
192+
- MSTest v3 enforces consistent timeout behavior, which might mean that tests configured with timeouts in previous versions may fail or behave differently if the timeout values are too short under the new standard.
193+
194+
**What This Means**:
195+
196+
1. **Tests with Timeouts Might Need Adjustment**: If your tests have a `Timeout` attribute with specific durations, verify that those values still allow the test to complete under MSTest v3. Tests that previously passed with a certain timeout might need a higher or lower timeout value to work correctly under the new rules.
197+
198+
2. **Unified Timeout Handling**: MSTest v3 unified timeout handling makes timeouts more predictable, but requires checking and potentially updating `Timeout` values in older tests.
199+
200+
**Example**:
201+
202+
```csharp
203+
// Old (v1/v2) - Timeout was sometimes interpreted inconsistently
204+
[TestMethod]
205+
[Timeout(2000)] // Timeout in milliseconds
206+
public void TestMethod() { ... }
207+
208+
// New (v3) - Unified handling of timeout
209+
[TestMethod]
210+
[Timeout(2000)] // Verify this value still works under MSTest v3
211+
public async Task TestMethod() { ... }
190212
191213
---
192214
@@ -196,7 +218,7 @@ Timeout settings are standardized across frameworks in MSTest v3. Verify and adj
196218
197219
MSTest v3 supports both XML and JSON formats for configuration files.
198220
199-
1. **Verify Configurations**: Ensure that existing `.runsettings` files align with MSTest v3’s syntax and structure.
221+
1. **Verify Configurations**: Ensure that existing `.runsettings` files align with MSTest v3 syntax and structure.
200222
2. **Convert to JSON (if applicable)**: For JSON-based configurations, convert XML settings to JSON format.
201223
202224
---

0 commit comments

Comments
 (0)