-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Document more MSTest attributes and APIs #50979
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?
Conversation
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.
Pull request overview
This PR enhances the MSTest attributes documentation by adding comprehensive coverage of previously undocumented attributes and APIs. The changes focus on data-driven testing features, test lifecycle management, threading models, conditional execution, and test control mechanisms.
Key changes include:
- Addition of
DiscoverInternalsAttributedocumentation for discovering internal test classes and methods. - Comprehensive documentation of data-driven testing features including
DynamicDataAttribute,TestDataRow, andUnfoldingStrategy. - Documentation of global test lifecycle attributes (
GlobalTestInitializeandGlobalTestCleanup). - Reorganization of test execution control attributes with new sections for threading, parallelization, timeout/retry, and conditional execution attributes.
Comments suppressed due to low confidence (5)
docs/core/testing/unit-testing-mstest-writing-tests-attributes.md:415
- This list is missing Oxford commas. The style guidelines require Oxford commas in all lists. Add commas before "and" in items where multiple concepts are joined.
- <xref:Microsoft.VisualStudio.TestTools.UnitTesting.UnfoldingStrategy.Auto?displayProperty=nameWithType> (default): MSTest automatically determines whether to unfold test cases based on the number of data rows. Test cases are collapsed (folded) when there are many data rows to avoid cluttering Test Explorer, and unfolded when there are few data rows for better visibility.
- <xref:Microsoft.VisualStudio.TestTools.UnitTesting.UnfoldingStrategy.Unfold?displayProperty=nameWithType>: All test cases are expanded and shown individually in Test Explorer and TRX results. Each test case can be run independently.
- <xref:Microsoft.VisualStudio.TestTools.UnitTesting.UnfoldingStrategy.Fold?displayProperty=nameWithType>: Test cases are collapsed into a single test node. Individual test cases cannot be run independently; the entire data-driven test runs as one unit.
docs/core/testing/unit-testing-mstest-writing-tests-attributes.md:378
- The list is missing an Oxford comma. Add a comma before "and" in the last item to comply with the Markdown writing style guidelines requiring Oxford commas in all lists.
- **Custom display names**: Set a unique display name for each test case using the <xref:Microsoft.VisualStudio.TestTools.UnitTesting.TestDataRow.DisplayName> property
- **Test properties**: Attach metadata to individual test cases using the <xref:Microsoft.VisualStudio.TestTools.UnitTesting.TestDataRow.TestProperties> property
- **Type-safe data**: Use the generic `TestDataRow<T>` to provide strongly-typed test data
docs/core/testing/unit-testing-mstest-writing-tests-attributes.md:639
- The list is missing an Oxford comma. Add a comma before "and a delay backoff type" to comply with the Markdown writing style guidelines requiring Oxford commas in all lists.
The [Retry](xref:Microsoft.VisualStudio.TestTools.UnitTesting.RetryAttribute) attribute was introduced in MSTest 3.8. This attribute causes the test method to be retried when it fails or timeouts. It allows you to specify the maximum number of retry attempts, the time delay between retries, and a delay backoff type, which is either constant or exponential.
docs/core/testing/unit-testing-mstest-writing-tests-attributes.md:705
- Add a comma after "for example" to properly set off this introductory phrase.
You can specify which operating systems the test supports or doesn't support using the [OperatingSystems](xref:Microsoft.VisualStudio.TestTools.UnitTesting.OperatingSystems) flags enum, which includes `Windows`, `Linux`, `OSX` (macOS), and `FreeBSD`. You can combine multiple operating systems using the bitwise OR operator.
docs/core/testing/unit-testing-mstest-writing-tests-attributes.md:378
- According to the Markdown writing style guidelines, list items should be complete sentences with proper punctuation. The benefit descriptions on lines 376-378 are sentence fragments without ending punctuation. Add periods at the end of each item to make them complete sentences.
- **Custom display names**: Set a unique display name for each test case using the <xref:Microsoft.VisualStudio.TestTools.UnitTesting.TestDataRow.DisplayName> property
- **Test properties**: Attach metadata to individual test cases using the <xref:Microsoft.VisualStudio.TestTools.UnitTesting.TestDataRow.TestProperties> property
- **Type-safe data**: Use the generic `TestDataRow<T>` to provide strongly-typed test data
docs/core/testing/unit-testing-mstest-writing-tests-attributes.md
Outdated
Show resolved
Hide resolved
docs/core/testing/unit-testing-mstest-writing-tests-attributes.md
Outdated
Show resolved
Hide resolved
docs/core/testing/unit-testing-mstest-writing-tests-attributes.md
Outdated
Show resolved
Hide resolved
docs/core/testing/unit-testing-mstest-writing-tests-attributes.md
Outdated
Show resolved
Hide resolved
docs/core/testing/unit-testing-mstest-writing-tests-attributes.md
Outdated
Show resolved
Hide resolved
| ### `ParallelizeAttribute` | ||
| #### `UITestMethodAttribute` | ||
|
|
||
| When applied to a test method, the `UITestMethod` attribute indicates that the test method should be scheduled on the UI thread of the platform. This attribute is specifically designed for testing UWP (Universal Windows Platform) and WinUI applications that require UI thread access. |
Copilot
AI
Jan 8, 2026
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 UITestMethod attribute is not referenced with an xref cross-reference like other attributes in the document. For consistency with the rest of the document and to provide proper linking, this should be [UITestMethod](xref:Microsoft.VisualStudio.TestTools.UnitTesting.UITestMethodAttribute) or similar.
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.
For some reason the API doc related to this attribute doesn't exist. @Youssef1313 is it because the attribute is not present in all TFMs?
|
@Youssef1313 @meaghanlewis working on this doc page, I feel like the attribute grouping is too technical and it would probably be better to have something like:
|
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
|
@Evangelink I've opened a new pull request, #50980, to work on those changes. Once the pull request is ready, I'll request review from you. |
|
@Evangelink I've opened a new pull request, #50981, to work on those changes. Once the pull request is ready, I'll request review from you. |
|
@Evangelink I've opened a new pull request, #50982, to work on those changes. Once the pull request is ready, I'll request review from you. |
|
@Evangelink I've opened a new pull request, #50983, to work on those changes. Once the pull request is ready, I'll request review from you. |
|
@Evangelink I've opened a new pull request, #50984, to work on those changes. Once the pull request is ready, I'll request review from you. |
|
@Evangelink I've opened a new pull request, #50985, to work on those changes. Once the pull request is ready, I'll request review from you. |
* Initial plan * Fix ambiguous contraction in TestPropertyAttribute documentation Co-authored-by: Evangelink <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: Evangelink <[email protected]>
#50982) * Initial plan * Change 'may take' to 'might take' for style compliance Co-authored-by: Evangelink <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: Evangelink <[email protected]>
* Initial plan * Add periods to list items per style guide Co-authored-by: Evangelink <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: Evangelink <[email protected]>
…50981) * Initial plan * Add missing using System.Reflection directive to DynamicDataDisplayName example Co-authored-by: Evangelink <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: Evangelink <[email protected]>
* Initial plan * Add missing comma after "for example" on line 450 Co-authored-by: Evangelink <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: Evangelink <[email protected]>
* Initial plan * Add missing Oxford commas and list punctuation Co-authored-by: Evangelink <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: Evangelink <[email protected]> Co-authored-by: Amaury Levé <[email protected]>
cc @Youssef1313
Internal previews