Skip to content

Conversation

@Youssef1313
Copy link
Member

This brings back the same behavior that was with VSTest, where we don't require --project and similar options for specifying what to test.

To limit the impact of this change, we only consider the first unmatched token.

This helps AI agents that always get confused and call MTP incorrectly.

@Youssef1313 Youssef1313 requested a review from a team as a code owner January 14, 2026 08:45
Copilot AI review requested due to automatic review settings January 14, 2026 08:45
@Youssef1313 Youssef1313 force-pushed the dev/ygerges/allow-positional-arg branch from 0dddf98 to 74b4ee0 Compare January 14, 2026 08:51
@Youssef1313 Youssef1313 force-pushed the dev/ygerges/allow-positional-arg branch from 74b4ee0 to 0786567 Compare January 14, 2026 09:00
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 changes the dotnet test command for Microsoft Testing Platform (MTP) to allow specifying projects, solutions, directories, or test modules as positional arguments (without requiring explicit switches like --project, --solution, or --test-modules), matching the behavior that existed in VSTest. The change only considers the first unmatched token to limit impact.

Changes:

  • Moved validation logic from ValidationUtility.cs to MSBuildUtility.cs and enhanced it to handle positional arguments
  • Added positional argument parsing in GetPositionalArguments() that detects file types and treats the first matching token as a positional argument
  • Updated PathOptions record to include TestModules field and renamed UnmatchedTokens to TestApplicationArguments in BuildOptions

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
MSBuildUtility.cs Added GetPositionalArguments() and ValidatePathOptions() to parse and validate positional arguments for projects, solutions, and test modules
ValidationUtility.cs Removed ValidateSolutionOrProjectOrDirectoryOrModulesArePassedCorrectly() and simplified ValidateMutuallyExclusiveOptions() to work with parsed path options
Options.cs Added TestModules field to PathOptions and renamed UnmatchedTokens to TestApplicationArguments in BuildOptions for clarity
MicrosoftTestingPlatformTestCommand.cs Reordered operations to parse build options before validation and updated condition to check PathOptions.TestModules
TestModulesFilterHandler.cs Changed method signature to accept testModules string parameter instead of extracting it from ParseResult
TestApplication.cs Updated to use renamed TestApplicationArguments field instead of UnmatchedTokens

@Youssef1313 Youssef1313 force-pushed the dev/ygerges/allow-positional-arg branch from 0786567 to 4187d5a Compare January 14, 2026 09:06
@Youssef1313 Youssef1313 force-pushed the dev/ygerges/allow-positional-arg branch from 4187d5a to 3ccebc5 Compare January 14, 2026 09:06
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.

3 participants