Skip to content

Document TestingPlatformCommandLineArguments for mixed frameworks/extensions#53371

Open
Evangelink wants to merge 5 commits intomainfrom
dev/amauryleve/mixed-frameworks-cli-args
Open

Document TestingPlatformCommandLineArguments for mixed frameworks/extensions#53371
Evangelink wants to merge 5 commits intomainfrom
dev/amauryleve/mixed-frameworks-cli-args

Conversation

@Evangelink
Copy link
Copy Markdown
Member

@Evangelink Evangelink commented Apr 24, 2026

Summary

Document how to use TestingPlatformCommandLineArguments with MSBuild conditions to avoid unrecognized CLI option errors when running dotnet test on solutions that mix test frameworks (for example, MSTest and xUnit.net) or reference different sets of extensions (for example, HangDump on only some projects).

Closes microsoft/testfx#7773

Changes

Main content (single source of truth)

  • docs/core/testing/unit-testing-with-dotnet-test.md — New section "Solutions with mixed test frameworks or extensions" covering:
    • Conditional routing of arguments via TestingPlatformCommandLineArguments with UsingMSTestSdk condition
    • Full dotnet test -p: invocation example
    • Table of common differing options across frameworks
    • Subsection for projects with different extensions (HangDump example)

Cross-references

  • docs/core/testing/microsoft-testing-platform-troubleshooting.md — New troubleshooting entry linking to the main section
  • docs/core/testing/migrating-vstest-microsoft-testing-platform.md — TIP callout in the --filter migration section
  • docs/core/tools/dotnet-test-mtp.md — Expanded existing TestingPlatformCommandLineArguments tip
  • docs/core/project-sdk/msbuild-props.md — Fixed incorrect description text and added cross-reference

Content source

All content is based on the discussion in microsoft/testfx#7773 (adapted, not copied verbatim). Expert review is recommended for the MSBuild condition patterns.


Internal previews

📄 File 🔗 Preview link
docs/core/project-sdk/msbuild-props.md MSBuild reference for .NET SDK projects
docs/core/testing/microsoft-testing-platform-troubleshooting.md Microsoft.Testing.Platform troubleshooting
docs/core/testing/migrating-vstest-microsoft-testing-platform.md Migrate from VSTest to Microsoft.Testing.Platform
docs/core/testing/unit-testing-with-dotnet-test.md docs/core/testing/unit-testing-with-dotnet-test
docs/core/tools/dotnet-test-mtp.md dotnet test with Microsoft.Testing.Platform (MTP)

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 documents how to use TestingPlatformCommandLineArguments with MSBuild conditions so dotnet test works in solutions that mix test frameworks (for example, MSTest and xUnit.net) or have extensions enabled only in some projects.

Changes:

  • Adds a new section to explain conditional routing patterns for framework-specific and extension-specific CLI options.
  • Adds cross-links from troubleshooting, migration guidance, and dotnet test MTP docs to the new section.
  • Fixes the TestingPlatformCommandLineArguments property description and adds a cross-reference in MSBuild properties docs.
Show a summary per file
File Description
docs/core/tools/dotnet-test-mtp.md Expands the TestingPlatformCommandLineArguments tip and links to the new mixed-framework guidance.
docs/core/testing/unit-testing-with-dotnet-test.md Adds the main “mixed test frameworks/extensions” section with examples and scenarios.
docs/core/testing/migrating-vstest-microsoft-testing-platform.md Adds a TIP pointing mixed-framework solutions to the new routing guidance.
docs/core/testing/microsoft-testing-platform-troubleshooting.md Adds a troubleshooting entry for exit code 5 due to unrecognized options in mixed solutions.
docs/core/project-sdk/msbuild-props.md Corrects the property description and adds a cross-reference to the new guidance.

Copilot's findings

Comments suppressed due to low confidence (1)

docs/core/testing/unit-testing-with-dotnet-test.md:221

  • The HangDump example conditions on $(EnableHangDump) == 'true', but the snippet doesn't show where EnableHangDump is set to true, and the sample dotnet test invocation only sets HangDumpArgs. As written, the condition will evaluate to false and HangDumpArgs won't be appended. Consider updating the snippet/text to show setting EnableHangDump in the projects that reference HangDump (or changing the condition to something that will actually be true based on package reference or another defined property).
To handle this case, condition the arguments on whether the extension's package is referenced. You can define a helper property in the project files that have the extension, and use that property as a condition:

```xml
<!-- In the .csproj files that reference HangDump (or via Directory.Build.targets) -->
<PropertyGroup Condition="'$(EnableHangDump)' == 'true'">
  <TestingPlatformCommandLineArguments>$(TestingPlatformCommandLineArguments) $(HangDumpArgs)</TestingPlatformCommandLineArguments>
</PropertyGroup>
  • Files reviewed: 5/5 changed files
  • Comments generated: 3

Comment thread docs/core/testing/unit-testing-with-dotnet-test.md
Comment thread docs/core/testing/unit-testing-with-dotnet-test.md Outdated
Comment thread docs/core/testing/unit-testing-with-dotnet-test.md
Comment thread docs/core/testing/unit-testing-with-dotnet-test.md Outdated
Comment thread docs/core/testing/unit-testing-with-dotnet-test.md Outdated
Evangelink and others added 3 commits April 24, 2026 22:51
Co-authored-by: Genevieve Warren <24882762+gewarren@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|----------|---------------|-----------|
| Test filtering | `--filter <expression>` | `--filter-trait`, `--filter-class`, `--filter-method`, `--filter-query` |
| xUnit.net built-in reports | Not available | `--report-xunit-junit`, `--report-xunit-html`, `--report-xunit-trx` |
| Ignore zero tests | `--ignore-exit-code 8` | `--ignore-exit-code 8` |
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't get the point you're trying to make by this example.


Each test project receives only the arguments relevant to its framework, and the other framework's arguments are never passed.

### Common scenarios
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This whole "Common scenarios" section is too wordy IMO without giving user and more useful info. Everything seems to be well explained from previous.

Comment thread docs/core/testing/unit-testing-with-dotnet-test.md Outdated
Co-authored-by: Youssef Victor <youssefvictor00@gmail.com>
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.

Migration from vstest

5 participants