Skip to content

Document MSTest 4.3 random test order and parallelization MSBuild properties#54480

Open
Evangelink wants to merge 4 commits into
mainfrom
dev/amauryleve/mstest43-config-parallelize-random
Open

Document MSTest 4.3 random test order and parallelization MSBuild properties#54480
Evangelink wants to merge 4 commits into
mainfrom
dev/amauryleve/mstest43-config-parallelize-random

Conversation

@Evangelink

@Evangelink Evangelink commented Jun 19, 2026

Copy link
Copy Markdown
Member

Documents three MSTest 4.3 configuration features that were missing from the docs. Unlike the new Assert APIs (which are blocked until 4.3 publishes its API reference), these are config/MSBuild features that need no API xrefs, so they're documentable now.

Changes to unit-testing-mstest-configure.md

  • Runsettings MSTest element: added RandomizeTestOrder (opt-in random test order) and RandomTestOrderSeed (reproducible seed).
  • testconfig.json execution settings: added the randomizeTestOrder and randomTestOrderSeed equivalents.
  • New MSBuild properties section: documents MSTestParallelizeScope and MSTestParallelizeWorkers for opting into assembly-level parallelization from the project file / Directory.Build.props (requires GenerateAssemblyInfo=true; None emits [assembly: DoNotParallelize]).

Changes to unit-testing-mstest-writing-tests-controlling-execution.md

  • Extended the parallelization TIP to cross-reference the new MSBuild properties.

Content source

  • RandomizeTestOrder / RandomTestOrderSeed element + testconfig keys (execution:randomizeTestOrder, execution:randomTestOrderSeed) and the OrderTestsByNameInClass conflict: verified from microsoft/testfx MSTestSettings.RunSettingsXml.cs and MSTestSettings.Configuration.cs.
  • MSTestParallelizeScope / MSTestParallelizeWorkers semantics, valid values, and GenerateAssemblyInfo requirement: verified from Parallelize.targets.
  • Features map to testfx PRs Command Not Working #8647 (random order) and Broken link #8233 (parallelize MSBuild props), both in the 4.3.0 changelog.

ai-usage: ai-assisted


Internal previews

📄 File 🔗 Preview link
docs/core/testing/unit-testing-mstest-configure.md Configure MSTest
docs/core/testing/unit-testing-mstest-writing-tests-controlling-execution.md Test execution and control in MSTest

…Build properties

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 19, 2026 14:36
@dotnetrepoman dotnetrepoman Bot added this to the June 2026 milestone Jun 19, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 updates MSTest documentation to cover newly available MSTest 4.3 configuration features for random test order and assembly-level parallelization, including how to configure them via runsettings, testconfig.json, and MSBuild properties.

Changes:

  • Documented RandomizeTestOrder and RandomTestOrderSeed for runsettings and testconfig.json.
  • Added an MSBuild properties section documenting MSTestParallelizeScope and MSTestParallelizeWorkers.
  • Updated the parallelization tip to cross-reference the new MSBuild properties section.
Show a summary per file
File Description
docs/core/testing/unit-testing-mstest-writing-tests-controlling-execution.md Adds ai-usage metadata and cross-references the new MSBuild parallelization properties in the parallelization tip.
docs/core/testing/unit-testing-mstest-configure.md Adds ai-usage metadata, documents MSTest 4.3 random-order settings, and adds an MSBuild properties section for assembly-level parallelization configuration.

Copilot's findings

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

Comment thread docs/core/testing/unit-testing-mstest-writing-tests-controlling-execution.md Outdated
Comment thread docs/core/testing/unit-testing-mstest-configure.md Outdated
Comment thread docs/core/testing/unit-testing-mstest-configure.md Outdated
Comment thread docs/core/testing/unit-testing-mstest-configure.md Outdated
Comment thread docs/core/testing/unit-testing-mstest-configure.md
…s, real attribute syntax in example

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@Evangelink Evangelink enabled auto-merge (squash) June 19, 2026 14:49
|**MapNotRunnableToFailed**|true|A value indicating whether a not runnable result is mapped to failed test.|
|**OrderTestsByNameInClass**|false|If you want to run tests by test names both in Test Explorers and on the command line, set this value to **true**.|
|**Parallelize**||Used to set the parallelization settings:<br /><br />**Workers**: The number of threads/workers to be used for parallelization, which is by default **the number of processors on the current machine**.<br /><br />**SCOPE**: The scope of parallelization. You can set it to **MethodLevel**. By default, it's **ClassLevel**.<br /><br />`<Parallelize><Workers>32</Workers><Scope>MethodLevel</Scope></Parallelize>`|
|**RandomizeTestOrder**|false|Starting with MSTest 4.3, set this value to **true** to run tests in a random order, which helps surface hidden ordering dependencies between tests. This setting can't be combined with **OrderTestsByNameInClass**.|

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

All the setting names should be put into backticks to prevent localization. You can see here in German that a few setting names are being localized.

https://learn.microsoft.com/de-de/dotnet/core/testing/unit-testing-mstest-configure?branch=pr-en-us-54480#runsettings

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in d8d42d4 — the runsettings MSTest element table now wraps all setting names (and literal values like MethodLevel/ClassLevel/EndOfAssembly) in backticks instead of bold so they're not localized.

Comment thread docs/core/testing/unit-testing-mstest-writing-tests-controlling-execution.md Outdated
Evangelink and others added 2 commits June 22, 2026 20:26
…g-execution.md

Co-authored-by: Genevieve Warren <24882762+gewarren@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants