Skip to content

Document more MSTest attributes and APIs#50979

Merged
Evangelink merged 13 commits intomainfrom
dev/amauryleve/mstest-apis
Jan 14, 2026
Merged

Document more MSTest attributes and APIs#50979
Evangelink merged 13 commits intomainfrom
dev/amauryleve/mstest-apis

Conversation

@Evangelink
Copy link
Member

@Evangelink Evangelink commented Jan 8, 2026

Copilot AI review requested due to automatic review settings January 8, 2026 11:16
@dotnetrepoman dotnetrepoman bot added this to the January 2026 milestone Jan 8, 2026
Copy link
Contributor

Copilot AI left a 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 DiscoverInternalsAttribute documentation for discovering internal test classes and methods.
  • Comprehensive documentation of data-driven testing features including DynamicDataAttribute, TestDataRow, and UnfoldingStrategy.
  • Documentation of global test lifecycle attributes (GlobalTestInitialize and GlobalTestCleanup).
  • 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

@Evangelink
Copy link
Member Author

@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:

  1. Overview (basics + getting started)
  2. Data-Driven Testing (keep separate - it's substantial)
  3. Test Lifecycle & Setup (fixtures)
  4. Test Execution & Control (threading, parallelization, timeout, retry, conditional execution combined)
  5. Metadata & Organization (all metadata attributes)

Evangelink and others added 2 commits January 8, 2026 12:24
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Contributor

Copilot AI commented Jan 8, 2026

@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.

Copy link
Contributor

Copilot AI commented Jan 8, 2026

@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.

Copy link
Contributor

Copilot AI commented Jan 8, 2026

@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.

Copy link
Contributor

Copilot AI commented Jan 8, 2026

@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.

Copy link
Contributor

Copilot AI commented Jan 8, 2026

@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.

Copy link
Contributor

Copilot AI commented Jan 8, 2026

@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.

Copilot AI and others added 6 commits January 8, 2026 12:30
* Initial plan

* Fix ambiguous contraction in TestPropertyAttribute documentation

Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com>
#50982)

* Initial plan

* Change 'may take' to 'might take' for style compliance

Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com>
* Initial plan

* Add periods to list items per style guide

Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com>
…50981)

* Initial plan

* Add missing using System.Reflection directive to DynamicDataDisplayName example

Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com>
* Initial plan

* Add missing comma after "for example" on line 450

Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com>
* Initial plan

* Add missing Oxford commas and list punctuation

Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com>
Co-authored-by: Amaury Levé <amauryleve@microsoft.com>
@Evangelink Evangelink enabled auto-merge (squash) January 8, 2026 14:16
Copy link
Contributor

@meaghanlewis meaghanlewis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes LGTM. I had a handful of suggestions for updated xrefs to use in place of the ones that weren't found. Also, other small language suggestions.

Evangelink and others added 2 commits January 14, 2026 11:03
Co-authored-by: Meaghan Osagie (Lewis) <mosagie@microsoft.com>
@Evangelink
Copy link
Member Author

@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:

  1. Overview (basics + getting started)
  2. Data-Driven Testing (keep separate - it's substantial)
  3. Test Lifecycle & Setup (fixtures)
  4. Test Execution & Control (threading, parallelization, timeout, retry, conditional execution combined)
  5. Metadata & Organization (all metadata attributes)

@meaghanlewis @Youssef1313 if you both agree, I'll do a follow-up PR after this one.

@Evangelink
Copy link
Member Author

@meaghanlewis it's complaining that it cannot find the Microsoft.VisualStudio.TestTools.UnitTesting.TestDataRow-1 prefix link but when I look at the doc API they do exist (e.g. https://learn.microsoft.com/dotnet/api/microsoft.visualstudio.testtools.unittesting.testdatarow-1)

@meaghanlewis
Copy link
Contributor

@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:

  1. Overview (basics + getting started)
  2. Data-Driven Testing (keep separate - it's substantial)
  3. Test Lifecycle & Setup (fixtures)
  4. Test Execution & Control (threading, parallelization, timeout, retry, conditional execution combined)
  5. Metadata & Organization (all metadata attributes)

@meaghanlewis @Youssef1313 if you both agree, I'll do a follow-up PR after this one.

Sounds like a plan!

@meaghanlewis
Copy link
Contributor

@meaghanlewis it's complaining that it cannot find the Microsoft.VisualStudio.TestTools.UnitTesting.TestDataRow-1 prefix link but when I look at the doc API they do exist (e.g. https://learn.microsoft.com/dotnet/api/microsoft.visualstudio.testtools.unittesting.testdatarow-1)

@Evangelink I had a look and can't figure out why these links aren't found. Maybe these can be left out for now and I can open up an issue to address this later.

@Evangelink
Copy link
Member Author

@Evangelink I had a look and can't figure out why these links aren't found. Maybe these can be left out for now and I can open up an issue to address this later.

Done! Could you please review/approve @meaghanlewis and @Youssef1313

@Evangelink Evangelink merged commit 5ac76b0 into main Jan 14, 2026
11 checks passed
@Evangelink Evangelink deleted the dev/amauryleve/mstest-apis branch January 14, 2026 22:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants