Skip to content

Add passive command-line option defaults - #10895

Merged
Amaury Levé (Evangelink) merged 5 commits into
mainfrom
dev/amauryleve/testing-platform-option-defaults
Sep 1, 2026
Merged

Add passive command-line option defaults#10895
Amaury Levé (Evangelink) merged 5 commits into
mainfrom
dev/amauryleve/testing-platform-option-defaults

Conversation

@Evangelink

Copy link
Copy Markdown
Member

Summary

  • add validated, passive commandLineOptionDefaults support to testconfig.json
  • expose TryGetOptionArgumentListOrDefault so extensions can consume defaults without enabling their feature
  • add generic TestingPlatformCommandLineOptionDefault MSBuild items that are projected into the built module configuration
  • use defaults for TRX and shared report filenames while preserving explicit CLI precedence
  • document both authoring surfaces and update the JSON schema

Validation

  • packed the repository successfully
  • passed Microsoft.Testing.Platform, Microsoft.Testing.Platform.MSBuild, and Microsoft.Testing.Extensions unit suites
  • passed TRX default/precedence acceptance tests across net462, net8.0, and net10.0
  • passed existing build/publish/configuration-file acceptance coverage

Fixes #6648

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: f86614b5-b40f-415d-8f94-a3290fbe7154
Copilot AI balanced review requested due to automatic review settings August 31, 2026 18:19
@github-actions

This comment has been minimized.

@github-actions github-actions Bot 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.

Note

🤖 Automated review by GitHub Copilot. Generated by the Expert Code Review workflow. To request a follow-up action, reply by tagging @copilot directly.

# Dimension Verdict
5 Performance & Allocations 🟡 1 NIT
15 Code Structure & Simplification 🟡 1 NIT

✅ 20/22 dimensions clean.

Summary: This is a well-structured, thorough PR that adds passive commandLineOptionDefaults support to testconfig.json with clean separation between active options and defaults. The design is sound — defaults never activate features, explicit values take precedence, and the MSBuild integration via TestingPlatformCommandLineOptionDefault items is ergonomic.

Key positives:

  • Public API surface is minimal (one extension method + one internal interface)
  • PublicAPI.Unshipped.txt and InternalAPI.Unshipped.txt are both updated correctly
  • The #if NETCOREAPP / Jsonite split keeps the netstandard2.0 MSBuild task self-contained
  • Validation (unknown options, arity, bootstrap-only, per-arg) is consistently extended to the new section
  • Test coverage is comprehensive: unit tests for merge logic, defaults-don't-activate, explicit-wins, error cases; plus acceptance tests for both MSBuild generation and TRX runtime behavior
  • Localization resources and xlf files are properly updated
  • JSON schema updated to match

Minor observations (inline):

  • The MSBuild Inputs sentinels for option defaults may disable incremental build for this target — worth monitoring
  • CommandLineOptionsProxy delegates to the extension method which re-checks the interface cast (functionally correct, slightly indirect)

@github-actions

Copy link
Copy Markdown
Contributor

🧪 Expert test review — PR #10895

GradeTestMutationNotesHow to improve
A (90–100) new MSBuildTests.
ConfigurationFileTask_
MergesOptionDefaultsAndPreservesJsonOverrides
4/4 killed Verifies both the JSON-wins-over-MSBuild precedence and multi-value array merging via TryCreateMergedConfiguration.
A (90–100) new MSBuildTests.
ConfigurationFileTask_
GeneratesConfigurationFromOptionDefaults
2/2 killed Confirms a config file is generated purely from MSBuild-supplied defaults with no source file present.
A (90–100) new MSBuildTests.
ConfigurationFileTask_
RejectsOptionNameWithLeadingHyphens
2/2 killed Asserts both the failure result and the specific error message content for the guard clause.
A (90–100) new MSBuildTests.
ConfigurationFileTask_
ReportsDuplicateJsonKeys
2/2 killed Exercises the case-insensitive duplicate-key detection path with a real malformed JSON fixture.
A (90–100) new MSBuildTests.
SelfRegisteredExtensions_
Fails_For_Duplicate_
BuilderHook_Ids_With_
Different_Metadata
3/3 killed Checks failure result, absence of output file, and exact conflicting-metadata error message.
A (90–100) new MSBuildTests.ConfigFileGeneration_
OptionDefaultsGenerateConfigurationWithoutSourceFile
3/3 killed End-to-end acceptance test proves defaults survive an actual build and a rebuild with an MSBuild property override.
A (90–100) new TrxTests.
Trx_CommandLineOptionDefault_
IsPassiveAndExplicitValueWins
3/3 killed Verifies passivity (no unwanted file), the configured default applying, and CLI override precedence in one flow.
A (90–100) new CommandLineHandlerTests.
GetOptionValueOrDefault_
DefaultDoesNotActivateOption
2/2 killed Distinguishes IsOptionSet/TryGetOptionArgumentList staying false from the default-aware accessor returning the fallback.
A (90–100) new CommandLineHandlerTests.
GetOptionValueOrDefault_
ExplicitValueWins
2/2 killed Confirms explicit CLI configuration wins over a configured default, matching the production precedence.
A (90–100) new JsonCommandLineOptionsTests.
EnumerateCommandLineOptionDefaults_
ScalarsAndArrays_AreArguments
4/4 killed Covers scalar, boolean, and array default entries plus the providers-facing lookup helpers in one assertion set.
A (90–100) new JsonCommandLineOptionsTests.
ExplicitJsonDisable_
SuppressesConfiguredDefault
2/2 killed Targets the specific case of an explicit false override suppressing a configured default.
A (90–100) new JsonCommandLineOptionsTests.
Validator_JsonDefaultPerArgValidatorFailure_
FailsWithDefaultsPrefix
3/3 killed Confirms the per-arg validator error message is prefixed distinctly for commandLineOptionDefaults vs plain JSON options.
A (90–100) new JsonCommandLineOptionsTests.
Validator_JsonDefaultForZeroArityOption_Fails
2/2 killed Verifies zero-arity options reject a default value with the option name surfaced in the error.
A (90–100) new JsonCommandLineOptionsTests.
Validator_UnknownJsonDefault_Fails
2/2 killed Uses a deliberate typo ("timoeut") to prove unknown default options are rejected by name.
A (90–100) new JsonCommandLineOptionsTests.
Validator_JsonDefaultBootstrapOnlyOption_Fails
2/2 killed Checks bootstrap-only options are rejected as defaults with both the option name and "bootstrap" in the message.
A (90–100) new JsonCommandLineOptionsTests.
Validator_JsonBootstrapOnlyOption_
DisabledEntry_StillFails
2/2 killed Extends bootstrap-only coverage to the disabled-entry case with a clear rationale comment.

All reviewed tests directly exercise the passive command-line option defaults feature added in this PR (MSBuild TestingPlatformCommandLineOptionDefault items, JSON commandLineOptionDefaults, and the IsOptionSet/TryGetOptionArgumentListOrDefault precedence chain) against the actual production code paths, use specific expected values instead of generic truthy checks, and assert both success/failure results and diagnostic error message content. No high-confidence actionable findings were identified, so no inline suggestions were posted.

This advisory comment was generated automatically. Grades are heuristic and informational — they do not block merging. Suggestions on the Files changed tab can be applied with one click. Re-run with /review-tests.

🤖 Automated content by GitHub Copilot. Generated by the Test Reviewer on PR (on open / sync) workflow. · auto · 134.2 AIC · ⌖ 2.74 AIC · ⊞ 16.9K · [◷]( · )

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.

Copilot review overview

Review tier: Balanced
Findings: 3 Medium severity

New issues introduced by this change (3)
Severity Finding
Medium severity src/​Platform/​Microsoft.Testing.Platform.MSBuild/​buildMultiTargeting/​Microsoft.Testing.Platform.MSBuild.targets — These transformed values are not real files, so MSBuild cannot use their timestamps as stable…
Medium severity src/​Platform/​Microsoft.Testing.Platform.MSBuild/​Tasks/​ConfigurationFileTask.cs — This shipped fallback is not as strict as the System.Text.Json branch. The package always loads the…
Medium severity src/​Platform/​Microsoft.Testing.Platform/​Configurations/​JsonConfigurationProvider.CommandLineOptions.cs — Reusing this enumerator also reuses its permissive empty-container behavior: empty arrays are…
What changed in this PR

Adds passive command-line option defaults across MTP configuration, MSBuild integration, and report filename handling, addressing #6648.

Changes:

  • Adds validated defaults with explicit-option precedence.
  • Projects MSBuild items into generated testconfig.json.
  • Applies defaults to report filenames and adds documentation/tests.
File Description
test/​UnitTests/​Microsoft.Testing.Platform.UnitTests/​Configuration/​JsonCommandLineOptionsTests.cs Tests parsing and validation.
test/​UnitTests/​Microsoft.Testing.Platform.UnitTests/​CommandLine/​CommandLineHandlerTests.cs Tests passive lookup and precedence.
test/​UnitTests/​Microsoft.Testing.Platform.MSBuild.UnitTests/​MSBuildTests.cs Tests configuration merging.
test/​UnitTests/​Microsoft.Testing.Platform.MSBuild.UnitTests/​InvokeTestingPlatformTaskTests.cs Updates filesystem stub.
test/​IntegrationTests/​Microsoft.Testing.Platform.Acceptance.IntegrationTests/​TrxTests.cs Tests TRX defaults and precedence.
test/​IntegrationTests/​Microsoft.Testing.Platform.Acceptance.IntegrationTests/​MSBuildTests.ConfigurationFile.cs Tests MSBuild-generated defaults.
src/​Platform/​SharedExtensionHelpers/​ReportEngineBase.cs Applies defaults to shared reporters.
src/​Platform/​Microsoft.Testing.Platform/​Resources/​xlf/​PlatformResources.zh-Hant.xlf Updates Traditional Chinese resources.
src/​Platform/​Microsoft.Testing.Platform/​Resources/​xlf/​PlatformResources.zh-Hans.xlf Updates Simplified Chinese resources.
src/​Platform/​Microsoft.Testing.Platform/​Resources/​xlf/​PlatformResources.tr.xlf Updates Turkish resources.
src/​Platform/​Microsoft.Testing.Platform/​Resources/​xlf/​PlatformResources.ru.xlf Updates Russian resources.
src/​Platform/​Microsoft.Testing.Platform/​Resources/​xlf/​PlatformResources.pt-BR.xlf Updates Portuguese resources.
src/​Platform/​Microsoft.Testing.Platform/​Resources/​xlf/​PlatformResources.pl.xlf Updates Polish resources.
src/​Platform/​Microsoft.Testing.Platform/​Resources/​xlf/​PlatformResources.ko.xlf Updates Korean resources.
src/​Platform/​Microsoft.Testing.Platform/​Resources/​xlf/​PlatformResources.ja.xlf Updates Japanese resources.
src/​Platform/​Microsoft.Testing.Platform/​Resources/​xlf/​PlatformResources.it.xlf Updates Italian resources.
src/​Platform/​Microsoft.Testing.Platform/​Resources/​xlf/​PlatformResources.fr.xlf Updates French resources.
src/​Platform/​Microsoft.Testing.Platform/​Resources/​xlf/​PlatformResources.es.xlf Updates Spanish resources.
src/​Platform/​Microsoft.Testing.Platform/​Resources/​xlf/​PlatformResources.de.xlf Updates German resources.
src/​Platform/​Microsoft.Testing.Platform/​Resources/​xlf/​PlatformResources.cs.xlf Updates Czech resources.
src/​Platform/​Microsoft.Testing.Platform/​Resources/​PlatformResources.resx Adds defaults-specific diagnostics.
src/​Platform/​Microsoft.Testing.Platform/​PublicAPI/​PublicAPI.Unshipped.txt Tracks the new public extension.
src/​Platform/​Microsoft.Testing.Platform/​InternalAPI/​InternalAPI.Unshipped.txt Tracks internal API changes.
src/​Platform/​Microsoft.Testing.Platform/​Hosts/​TestHostBuilder.CommonServices.cs Loads and validates defaults.
src/​Platform/​Microsoft.Testing.Platform/​Configurations/​PlatformConfigurationConstants.cs Defines the defaults section name.
src/​Platform/​Microsoft.Testing.Platform/​Configurations/​JsonConfigurationProvider.CommandLineOptions.cs Parses default entries.
src/​Platform/​Microsoft.Testing.Platform/​Configurations/​JsonCommandLineOptionEntry.cs Generalizes entry documentation.
src/​Platform/​Microsoft.Testing.Platform/​Configurations/​ConfigurationExtensions.cs Implements default lookup and precedence.
src/​Platform/​Microsoft.Testing.Platform/​Configurations/​AggregatedConfiguration.cs Resolves defaults across providers.
src/​Platform/​Microsoft.Testing.Platform/​CommandLine/​ICommandLineOptions.cs Exposes passive default lookup.
src/​Platform/​Microsoft.Testing.Platform/​CommandLine/​CommandLineOptionsValidator.UnknownAndBootstrapValidation.cs Validates unknown/bootstrap defaults.
src/​Platform/​Microsoft.Testing.Platform/​CommandLine/​CommandLineOptionsValidator.cs Integrates default validation.
src/​Platform/​Microsoft.Testing.Platform/​CommandLine/​CommandLineOptionsValidator.ArityValidation.cs Validates default arity.
src/​Platform/​Microsoft.Testing.Platform/​CommandLine/​CommandLineOptionsValidator.ArgumentAndConfigurationValidation.cs Validates default arguments.
src/​Platform/​Microsoft.Testing.Platform/​CommandLine/​CommandLineOptionsProxy.cs Forwards default lookup.
src/​Platform/​Microsoft.Testing.Platform/​CommandLine/​CommandLineHandler.cs Implements runtime default lookup.
src/​Platform/​Microsoft.Testing.Platform.MSBuild/​Tasks/​ConfigurationFileTask.cs Merges defaults into JSON.
src/​Platform/​Microsoft.Testing.Platform.MSBuild/​PACKAGE.md Documents authoring surfaces.
src/​Platform/​Microsoft.Testing.Platform.MSBuild/​Microsoft.Testing.Platform.MSBuild.csproj Embeds Jsonite for down-level tasks.
src/​Platform/​Microsoft.Testing.Platform.MSBuild/​IFileSystem.cs Adds configuration-file reading.
src/​Platform/​Microsoft.Testing.Platform.MSBuild/​FileSystem.cs Implements file reading.
src/​Platform/​Microsoft.Testing.Platform.MSBuild/​buildMultiTargeting/​Microsoft.Testing.Platform.MSBuild.targets Passes defaults into generation.
src/​Platform/​Microsoft.Testing.Extensions.TrxReport/​TrxReportEngine.cs Applies passive TRX filename defaults.
docs/​testconfig.schema.md Documents schema coverage.
docs/​testconfig.schema.json Defines defaults schema.

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@Evangelink Amaury Levé (Evangelink) added the state/needs-review Awaiting review from the team. label Sep 1, 2026
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: f86614b5-b40f-415d-8f94-a3290fbe7154
Copilot AI review requested due to automatic review settings September 1, 2026 09:31
@github-actions

This comment has been minimized.

@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

🧪 Expert test review — PR #10895

Reviewed the 11 new test methods across 5 changed test files (integration and unit) covering the new passive commandLineOptionDefaults feature.

GradeTestMutationNotesHow to improve
A (90-100) new CommandLineHandlerTests.
GetOptionValueOrDefault_
DefaultDoesNotActivateOption
3/3 killed Precisely proves defaults do not flip IsOptionSet/TryGetOptionArgumentList while still surfacing via OrDefault. -
A (90-100) new CommandLineHandlerTests.
GetOptionValueOrDefault_
ExplicitValueWins
2/2 killed Confirms explicit commandLineOptions value takes precedence over a configured default. -
A (90-100) new CommandLineHandlerTests.
GetOptionValueOrDefault_
NullOptionNameThrows
1/1 killed Exception test verifying the ArgumentNullException guard on the new extension method. -
A (90-100) new MSBuildTests.
ConfigurationFileTask_
MergesOptionDefaultsAndPreserves
JsonOverrides
4/4 killed Verifies JSON-configured default wins over MSBuild default, array collapsing, and preserved sibling sections. -
A (90-100) new MSBuildTests.
ConfigurationFileTask_
GeneratesConfigurationFromOptionDefaults
2/2 killed Covers generation of a configuration file purely from MSBuild-supplied defaults with no source file. -
A (90-100) new MSBuildTests.
ConfigurationFileTask_
RejectsOptionNameWithLeadingHyphens
1/1 killed Asserts exact error text matching the production Log.LogError message. -
A (90-100) new MSBuildTests.
ConfigurationFileTask_
ReportsDuplicateJsonKeys
1/1 killed Verifies duplicate-key detection surfaces a case-insensitive error for a malformed source file. -
A (90-100) new MSBuildTests.
ConfigFileGeneration_
OptionDefaultsGenerateConfiguration
WithoutSourceFile
4/4 killed End-to-end MSBuild acceptance test: generation, no-op incremental skip, and property-driven regeneration. -
A (90-100) new MSBuildTests.
ConfigFileGeneration_
PackagedTaskRejectsInvalidJson
2/2 killed Data-driven acceptance test asserting non-zero exit and parse-failure message for duplicate keys and trailing content. -
A (90-100) new TrxTests.
Trx_CommandLineOptionDefault_
IsPassiveAndExplicitValueWins
3/3 killed Verifies a configured default is inert until --report-trx is passed, then applies, then defers to an explicit CLI override. -
A (90-100) new JsonCommandLineOptionsTests.
EnumerateCommandLineOptionDefaults_
ScalarsAndArrays_AreArguments
3/3 killed Checks scalar and array default entries are enumerated correctly and do not activate commandLineOptions. -
A (90-100) new JsonCommandLineOptionsTests.
EnumerateCommandLineOptionDefaults_
MissingValue_IsRejected
2/2 killed Data-driven FormatException test for null/empty-array default values, asserting message content precisely. -

This advisory comment was generated automatically. Grades are heuristic and informational -- they do not block merging. Re-run with /review-tests.

🤖 Automated content by GitHub Copilot. Generated by the Test Reviewer on PR (on open / sync) workflow. · auto · 178.8 AIC · ⌖ 3.01 AIC · ⊞ 16.9K · [◷]( · )

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.

Copilot review overview

Review tier: Balanced
Findings: 2 Medium severity

New issues introduced by this change (2)
Severity Finding
Medium severity src/​Platform/​Microsoft.Testing.Platform.MSBuild/​buildMultiTargeting/​Microsoft.Testing.Platform.MSBuild.targets — When this item list transitions from non-empty to empty while a source testconfig.json still…
Medium severity src/​Platform/​SharedExtensionHelpers/​ReportEngineBase.csTryGetOptionArgumentListOrDefault returns true for a passive fallback too, so wasExplicit and…
Issues resolved since last review (3)
Severity Finding
Medium severity src/​Platform/​Microsoft.Testing.Platform/​Configurations/​JsonConfigurationProvider.CommandLineOptions.cs — Reusing this enumerator also reuses its permissive empty-container behavior: empty arrays are… View resolved comment
Medium severity src/​Platform/​Microsoft.Testing.Platform.MSBuild/​Tasks/​ConfigurationFileTask.cs — This shipped fallback is not as strict as the System.Text.Json branch. The package always loads the… View resolved comment
Medium severity src/​Platform/​Microsoft.Testing.Platform.MSBuild/​buildMultiTargeting/​Microsoft.Testing.Platform.MSBuild.targets — These transformed values are not real files, so MSBuild cannot use their timestamps as stable… View resolved comment
Suppressed comments (1)

src/Platform/Microsoft.Testing.Platform.MSBuild/buildMultiTargeting/Microsoft.Testing.Platform.MSBuild.targets:58

  • The cache hashes only the default items, while the source path is included as an input only when it currently exists. If a project with defaults deletes testconfig.json, the item hash is unchanged and the deleted source disappears from Inputs; therefore the core target can be skipped and its output retains all settings from the deleted source file. Include the source-existence state in the cache hash so adding/removing the file invalidates the generated configuration.
      <_GenerateTestingPlatformConfigurationFileInputsToHash Include="@(TestingPlatformCommandLineOptionDefault->'%(Identity)=%(Value)')" />

Comment thread src/Platform/SharedExtensionHelpers/ReportEngineBase.cs Outdated
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: f86614b5-b40f-415d-8f94-a3290fbe7154
Copilot AI review requested due to automatic review settings September 1, 2026 10:33
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

🧪 Expert test review — PR #10895

GradeTestMutationNotesHow to improve
A (90–100) new CommandLineHandlerTests.
GetOptionValueOrDefault_
DefaultDoesNotActivateOption
3/3 killed Asserts IsOptionSet/TryGetOptionArgumentList stay false while the OrDefault path returns the configured fallback.
A (90–100) new CommandLineHandlerTests.
GetOptionValueOrDefault_
ExplicitValueWins
2/2 killed Confirms an explicit commandLineOptions value takes precedence over the configured default.
A (90–100) new CommandLineHandlerTests.
GetOptionValueOrDefault_
NullOptionNameThrows
1/1 killed Directly targets the new ArgumentNullException guard added on the extension method's optionName parameter.
A (90–100) new JsonCommandLineOptionsTests.
EnumerateCommandLineOptionDefaults_
ScalarsAndArrays_
AreArguments
5/5 killed Covers scalar, boolean, and array defaults plus asserting the option is not treated as explicitly set.
A (90–100) new JsonCommandLineOptionsTests.
EnumerateCommandLineOptionDefaults_
MissingValue_
IsRejected
2/2 killed Data-driven over null and empty-array shapes, asserting the FormatException message names the option.
A (90–100) new JsonCommandLineOptionsTests.
ExplicitJsonDisable_
SuppressesConfiguredDefault
2/2 killed Verifies an explicit false disables the option even when a configured default exists.
A (90–100) new JsonCommandLineOptionsTests.
Validator_
JsonDefaultPerArgValidatorFailure_
FailsWithDefaultsPrefix
2/2 killed Confirms per-arg validator failures on defaults are reported with a distinguishing prefix.
A (90–100) new JsonCommandLineOptionsTests.
Validator_
JsonDefaultForZeroArityOption_
Fails
2/2 killed Exercises the arity-mismatch branch specifically for defaults against a zero-arity option.
A (90–100) new JsonCommandLineOptionsTests.
Validator_
UnknownJsonDefault_
Fails
2/2 killed Uses a deliberately misspelled option name and asserts it surfaces in the error message.
A (90–100) new JsonCommandLineOptionsTests.
Validator_
JsonDefaultBootstrapOnlyOption_
Fails
2/2 killed Verifies bootstrap-only options rejected in commandLineOptions are also rejected via defaults.
A (90–100) new MSBuildTests.
ConfigurationFileTask_
MergesOptionDefaultsAndPreservesJsonOverrides
4/4 killed Verifies JSON overrides MSBuild-supplied defaults and multi-value item lists are preserved in order.
A (90–100) new MSBuildTests.
ConfigurationFileTask_
GeneratesConfigurationFromOptionDefaults
2/2 killed Confirms a configuration file is generated purely from MSBuild-provided defaults with no source file.
A (90–100) new MSBuildTests.
ConfigurationFileTask_
RejectsOptionNameWithLeadingHyphens
2/2 killed Asserts task failure and the specific error text for a malformed item Include with a leading hyphen.
A (90–100) new MSBuildTests.
ConfigurationFileTask_
ReportsDuplicateJsonKeys
2/2 killed Exercises the case-insensitive duplicate-key guard on the packaged JSON merge path.
A (90–100) new TrxTests.
Trx_
CommandLineOptionDefault_
IsPassiveAndExplicitValueWins
3/3 killed End-to-end run proves the default is passive (no file until an enabling flag) and yields to an explicit filename.
A (90–100) new MSBuildTests.ConfigurationFile.
ConfigFileGeneration_
OptionDefaultsGenerateConfigurationWithoutSourceFile
3/3 killed Real MSBuild round-trip checks generation, incremental no-op skip, and regeneration on a changed property.
A (90–100) new MSBuildTests.ConfigurationFile.
ConfigFileGeneration_
PackagedTaskRejectsInvalidJson
2/2 killed Data-driven over duplicate-key and trailing-content malformed JSON, asserting the packaged task fails the build.
A (90–100) new MSBuildTests.ConfigurationFile.
ConfigFileGeneration_
RemovingAllOptionDefaultsRefreshesConfiguration
2/2 killed Confirms removing a conditional default via a build property refreshes the generated file rather than leaving stale JSON.

All 18 new/modified test methods in this PR's commandLineOptionDefaults feature are well-targeted: each asserts specific, non-tautological outcomes (exact error messages, exact merged JSON values, exact precedence between explicit/default/disabled states) that map to distinct branches in ConfigurationExtensions, CommandLineOptionsValidator, ConfigurationFileTask, and the MSBuild-generated config pipeline. No high-confidence actionable findings were found, so no inline suggestions are posted this run — the pre-existing review threads on production code (proxy indirection, incremental-build sentinel inputs, Jsonite strictness, WasExplicit contract) are already resolved/addressed per the thread history.

This advisory comment was generated automatically. Grades are heuristic
and informational — they do not block merging. Suggestions on the Files
changed tab can be applied with one click. Re-run with
/review-tests.

🤖 Automated content by GitHub Copilot. Generated by the Test Reviewer on PR (on open / sync) workflow. · auto · 84.5 AIC · ⌖ 2.97 AIC · ⊞ 16.9K · [◷]( · )

@github-actions

This comment has been minimized.

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.

Copilot review overview

Review tier: Balanced
Findings: 1 Medium severity · 1 Low severity

New issues introduced by this change (2)
Severity Finding
Medium severity src/​Platform/​Microsoft.Testing.Platform/​Configurations/​JsonConfigurationProvider.CommandLineOptions.cs — Defaults containing an array element of JSON null are still accepted even though the schema and…
Low severity src/​Platform/​SharedExtensionHelpers/​ReportEngineBase.cs — The added TRX acceptance test does not exercise this shared implementation because…
Issues resolved since last review (2)
Severity Finding
Medium severity src/​Platform/​SharedExtensionHelpers/​ReportEngineBase.csTryGetOptionArgumentListOrDefault returns true for a passive fallback too, so wasExplicit and… View resolved comment
Medium severity src/​Platform/​Microsoft.Testing.Platform.MSBuild/​buildMultiTargeting/​Microsoft.Testing.Platform.MSBuild.targets — When this item list transitions from non-empty to empty while a source testconfig.json still… View resolved comment
Suppressed comments (1)

Previously missed (1) — in code that hasn't changed since the last review.

src/Platform/Microsoft.Testing.Platform/ServerMode/JsonRpc/Json/Jsonite/JsonReader.cs:132

  • This end-of-document check confuses the Eof character sentinel ('\0') with actual end-of-input. A document followed by a literal NUL byte leaves isEof == false but c == Eof, so the packaged MSBuild task accepts invalid trailing content that the System.Text.Json path rejects. Check the reader's EOF state instead.

Comment thread src/Platform/SharedExtensionHelpers/ReportEngineBase.cs
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: f86614b5-b40f-415d-8f94-a3290fbe7154
Copilot AI review requested due to automatic review settings September 1, 2026 11:12
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

🧪 Expert test review — PR #10895

This PR adds passive commandLineOptionDefaults support (testconfig.json + MSBuild TestingPlatformCommandLineOptionDefault items) across the platform, MSBuild task, and command-line handler. The new/modified tests are consistently strong: end-to-end acceptance tests for TRX/CTRF exercise the full passive-default → explicit-override flow, MSBuild integration tests verify generated config content and build incrementality, and unit tests cover validator/parser edge cases (duplicate keys, null array elements, zero-arity rejection, bootstrap-only options) with precise assertions.

GradeTestMutationNotesHow to improve
B (80–89) new MSBuildTests.
ConfigurationFileTask_
ReportsDuplicateJsonKeys
2/3 killed Verifies the duplicate-key error but not that no output file was written on this failure path. Assert the output file was not written after the failed Execute().
A (90–100) new CtrfReportTests.
Ctrf_
CommandLineOptionDefault_
IsPassiveAndExplicitValueWins
4/4 killed Verifies passivity (no report enabled without --report-ctrf), default applied, and explicit override wins.
A (90–100) new TrxTests.
Trx_
CommandLineOptionDefault_
IsPassiveAndExplicitValueWins
4/4 killed Same end-to-end pattern as the CTRF test, mirrored correctly for TRX.
A (90–100) new MSBuildTests.
ConfigurationFileTask_
ConfigurationFileTask_
MergesOptionDefaultsAndPreservesJsonOverrides
4/4 killed Confirms JSON-sourced default wins over MSBuild-sourced default, and array ordering is preserved.
A (90–100) new MSBuildTests.
ConfigurationFileTask_
GeneratesConfigurationFromOptionDefaults
3/3 killed Confirms a config file is generated purely from MSBuild items when no source testconfig.json exists.
A (90–100) new MSBuildTests.
ConfigurationFileTask_
RejectsOptionNameWithLeadingHyphens
2/2 killed Confirms the task fails fast with a clear error for malformed item names.
A (90–100) new MSBuildTests.ConfigFileGeneration_
OptionDefaultsGenerateConfigurationWithoutSourceFile
3/3 killed End-to-end MSBuild build verifies generated JSON content, incremental no-op skip, and property-driven regeneration.
A (90–100) new MSBuildTests.ConfigFileGeneration_
PackagedTaskRejectsInvalidJson
2/2 killed Data-driven coverage of duplicate-key and trailing-content invalid JSON via the packaged task.
A (90–100) new MSBuildTests.ConfigFileGeneration_
RemovingAllOptionDefaultsRefreshesConfiguration
3/3 killed Confirms removing all defaults regenerates the file and drops the section while other content survives.
A (90–100) new CommandLineHandlerTests.
GetOptionValueOrDefault_
DefaultDoesNotActivateOption
3/3 killed Confirms a JSON default does not set IsOptionSet/TryGetOptionArgumentList but is returned by the OrDefault API.
A (90–100) new CommandLineHandlerTests.
GetOptionValueOrDefault_
ExplicitValueWins
2/2 killed Confirms an explicit value takes priority over a configured default.
A (90–100) new CommandLineHandlerTests.
GetOptionValueOrDefault_
NullOptionNameThrows
1/1 killed Confirms the extension method's null-argument guard on optionName.
A (90–100) new JsonCommandLineOptionsTests.
EnumerateCommandLineOptionDefaults_
ScalarsAndArrays_
AreArguments
5/5 killed Covers scalar, boolean, and array default shapes plus provider lookup and non-activation via TryGetCommandLineOptionFromProviders.
A (90–100) new JsonCommandLineOptionsTests.
EnumerateCommandLineOptionDefaults_
MissingValue_
IsRejected
2/2 killed Data-driven null/[] cases both correctly rejected with a clear message.
A (90–100) new JsonCommandLineOptionsTests.
EnumerateCommandLineOptionDefaults_
ArrayWithNullElement_
IsRejected
2/2 killed Targets the specific cross-parser null-flattening pitfall called out in the code comment.
A (90–100) new JsonCommandLineOptionsTests.
EnumerateCommandLineOptionDefaults_
MixedArrayWithNullElement_
IsRejected
2/2 killed Confirms a null element is rejected even mid-array alongside valid scalars.
A (90–100) new JsonCommandLineOptionsTests.
EnumerateCommandLineOptions_
ArrayWithNullElement_
PreservesEstablishedBehavior
2/2 killed Locks in the pre-existing (non-defaults) null-flattening behavior per TFM with a documented rationale.
A (90–100) new JsonCommandLineOptionsTests.
ExplicitJsonDisable_
SuppressesConfiguredDefault
2/2 killed Confirms an explicit false in commandLineOptions suppresses a configured default rather than falling back to it.
A (90–100) new JsonCommandLineOptionsTests.
Validator_
JsonDefaultPerArgValidatorFailure_
FailsWithDefaultsPrefix
2/2 killed Confirms per-arg validation runs against JSON defaults and the error is prefixed distinctly from regular JSON options.
A (90–100) new JsonCommandLineOptionsTests.
Validator_
JsonDefaultForZeroArityOption_
Fails
2/2 killed Confirms a default is rejected for a zero-arity (flag) option.
A (90–100) new JsonCommandLineOptionsTests.
Validator_
UnknownJsonDefault_
Fails
2/2 killed Confirms an unrecognized option name in defaults is rejected with the offending name in the message.
A (90–100) new JsonCommandLineOptionsTests.
Validator_
JsonDefaultBootstrapOnlyOption_
Fails
2/2 killed Confirms a bootstrap-only option (e.g. config-file path) cannot be set via defaults.

This advisory comment was generated automatically. Grades are heuristic
and informational — they do not block merging. Suggestions on the Files
changed tab can be applied with one click. Re-run with
/review-tests.

🤖 Automated content by GitHub Copilot. Generated by the Test Reviewer on PR (on open / sync) workflow. · auto · 147 AIC · ⌖ 2.89 AIC · ⊞ 16.9K · [◷]( · )

@github-actions

This comment has been minimized.

@github-actions github-actions Bot 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.

🤖 Automated content by GitHub Copilot. Generated by the Test Reviewer on PR (on open / sync) workflow. · auto · 147 AIC · ⌖ 2.89 AIC · ⊞ 16.9K ·

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: f86614b5-b40f-415d-8f94-a3290fbe7154

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.

Copilot review overview

Review tier: Balanced
Findings: None

Issues resolved since last review (2)
Severity Finding
Low severity src/​Platform/​SharedExtensionHelpers/​ReportEngineBase.cs — The added TRX acceptance test does not exercise this shared implementation because… View resolved comment
Medium severity src/​Platform/​Microsoft.Testing.Platform/​Configurations/​JsonConfigurationProvider.CommandLineOptions.cs — Defaults containing an array element of JSON null are still accepted even though the schema and… View resolved comment
Suppressed comments (1)

src/Platform/Microsoft.Testing.Platform.MSBuild/Tasks/ConfigurationFileTask.cs:404

  • The netstandard task only checks case-insensitive collisions among properties matching requestedKey. A source such as {"platformOptions":{},"PlatformOptions":{}}, or duplicate-cased defaults unrelated to the MSBuild items being merged, therefore passes and is re-emitted even though the runtime configuration parser treats keys case-insensitively and rejects the generated file. Validate all property names in each visited object, matching the HashSet check in the NETCOREAPP branch, before selecting the requested value.
        foreach (KeyValuePair<string, object?> entry in jsonObject)
        {
            if (!string.Equals(entry.Key, requestedKey, StringComparison.OrdinalIgnoreCase))
            {
                continue;

Copilot AI review requested due to automatic review settings September 1, 2026 11:25
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

🧪 Expert test review — PR #10895

No new or modified test methods were identified in the changed regions
of this PR. Nothing to review.

Re-run with /review-tests.

🤖 Automated content by GitHub Copilot. Generated by the Test Reviewer on PR (on open / sync) workflow. · auto · 37.7 AIC · ⌖ 2.43 AIC · ⊞ 16.9K · [◷]( · )

@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

🧵 Parallel-safety audit — PR #10895

Reviewed all 7 changed test files (CtrfReportTests.cs, MSBuildTests.ConfigurationFile.cs, TrxTests.cs, InvokeTestingPlatformTaskTests.cs, MSBuildTests.cs, CommandLineHandlerTests.cs, JsonCommandLineOptionsTests.cs). No changed config/parallelization files (.runsettings, testconfig.json, MSBuild props/targets, or assembly-level [Parallelize]/[DoNotParallelize]) in this PR.

Every added/modified test:

  • Uses in-memory fakes (InMemoryFileSystem, StubFileSystem) or Moq mocks for MSBuildTests.cs, InvokeTestingPlatformTaskTests.cs, CommandLineHandlerTests.cs, and JsonCommandLineOptionsTests.cs — no process-global or shared-filesystem state touched.
  • Uses a unique TempDirectory clone (CtrfReportTests.cs, TrxTests.cs) or TestAsset.GenerateAssetAsync (MSBuildTests.ConfigurationFile.cs) for any real I/O — each test gets its own isolated directory, no shared/hardcoded paths, no relative-path or CWD dependency, no env var/culture/console mutation, no static field writes.

Nothing to flag for parallel-safety.

Audited:

Test assembly Scope Workers
Microsoft.Testing.Platform.MSBuild.UnitTests MethodLevel CPU count
Microsoft.Testing.Platform.UnitTests MethodLevel CPU count
Microsoft.Testing.Platform.Acceptance.IntegrationTests MethodLevel CPU count

Advisory only — heuristic, non-blocking. Re-run with /parallel-audit.

🤖 Automated content by GitHub Copilot. Generated by the Parallel-safety audit on PR (on open / sync) workflow. · auto · 90.8 AIC · ⌖ 4.18 AIC · ⊞ 24.8K · [◷]( · )

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.

Copilot review overview

Review tier: Balanced
Findings: None

@Evangelink
Amaury Levé (Evangelink) merged commit dabbc28 into main Sep 1, 2026
40 checks passed
@Evangelink
Amaury Levé (Evangelink) deleted the dev/amauryleve/testing-platform-option-defaults branch September 1, 2026 13:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

state/needs-review Awaiting review from the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Microsoft.Testing.Extensions.TrxReport should allow customizing trx file name via dedicated MSBuild property

3 participants