close
Skip to content

Document discovery/execution phases and folded vs. unfolded test behavior#53360

Open
Evangelink wants to merge 1 commit intomainfrom
dev/amauryleve/parameterized-tests-discovery-folding
Open

Document discovery/execution phases and folded vs. unfolded test behavior#53360
Evangelink wants to merge 1 commit intomainfrom
dev/amauryleve/parameterized-tests-discovery-folding

Conversation

@Evangelink
Copy link
Copy Markdown
Member

@Evangelink Evangelink commented Apr 23, 2026

Summary

Expands the "Unfolding strategy" section in the data-driven testing article to document important behavioral details that were previously missing.

Changes

  • Discovery and execution phases: Explains that data sources are evaluated during discovery before any MSTest lifecycle hooks (AssemblyInitialize, ClassInitialize) run, and that data-generation code can't rely on state from those hooks.
  • Folded vs. unfolded tests: Clarifies the concrete differences—unfolded tests appear as separate entries in Test Explorer and TRX with individual pass/fail status, while folded tests appear as a single node with multiple results.
  • Exception during discovery causes folding: Documents that an exception during data source evaluation causes the test to fall back to folded, and that execution might succeed because lifecycle hooks have run by then. Includes a note about the debugging experience (seeing an exception, pressing Continue, test runs normally).
  • Style fixes: "allows you to" → "lets you", "one or multiple" → "one or more", heading formatting consistency for TestDataRow, "associated to" → "associated with", numbered list → bullet list for non-procedural best practices.

Related to microsoft/testfx#7774


Internal previews

📄 File 🔗 Preview link
docs/core/testing/unit-testing-mstest-writing-tests-data-driven.md Data-driven testing in MSTest

Copilot AI review requested due to automatic review settings April 23, 2026 14:37
@dotnetrepoman dotnetrepoman Bot added this to the April 2026 milestone Apr 23, 2026
@Evangelink Evangelink enabled auto-merge (squash) April 23, 2026 14:41
Copy link
Copy Markdown
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 expands the Unfolding strategy section in the MSTest data-driven testing article to document previously undocumented behavior around discovery-time data evaluation, and how folded versus unfolded results show up in Test Explorer and TRX.

Changes:

  • Document MSTest’s discovery-versus-execution behavior for data sources, including lifecycle hook timing implications.
  • Clarify folded versus unfolded reporting, and describe fallback-to-folding behavior when discovery-time evaluation throws.
  • Apply small style and consistency edits (wording tweaks, heading formatting, and list formatting).
Show a summary per file
File Description
docs/core/testing/unit-testing-mstest-writing-tests-data-driven.md Adds discovery/execution and folded/unfolded behavioral details to improve the accuracy and usefulness of the unfolding strategy guidance.

Copilot's findings

  • Files reviewed: 1/1 changed files
  • Comments generated: 2

Comment on lines +497 to +501
MSTest processes data-driven tests in two distinct phases:

1. **Discovery phase**: MSTest evaluates all data source attributes (`DataRow`, `DynamicData`, `ITestDataSource`) to determine the list of test cases. This evaluation happens *before* any of the regular MSTest lifecycle hooks run—`AssemblyInitialize`, `ClassInitialize`, and other setup methods haven't executed yet.
1. **Execution phase**: MSTest runs the normal lifecycle (assembly initialization, class initialization, test initialization, test method, cleanup) and executes each test case with its data.

Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

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

The numbered list under "MSTest processes data-driven tests in two distinct phases" describes concepts, not procedural steps. Convert the ordered list to a bulleted list (or another non-procedural format) to match the repo’s Markdown style guidance for lists.

Copilot generated this review using guidance from repository custom instructions.
Comment on lines +530 to +534
For most scenarios, the default `Auto` behavior provides the best balance. Consider changing the unfolding strategy when you have specific requirements:

- Non-deterministic data sources
- Known limitations or bugs in MSTest
- Performance concerns with many test cases
- Data sources that depend on runtime state or setup logic that isn't available during discovery
- Non-deterministic data sources that return different values on each evaluation
- Performance concerns with large numbers of test cases
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

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

The bullets under "When to change the strategy" are fragments and don’t end with punctuation. Rewrite each bullet as a complete sentence (and add terminal punctuation) to match the doc’s list style in surrounding sections.

Copilot generated this review using guidance from repository custom instructions.
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.

2 participants