Skip to content

Add testconfig.json JSON schema for SchemaStore publication#9405

Merged
Evangelink merged 1 commit into
mainfrom
evangelink-publish-schema-to-schemastore
Jun 24, 2026
Merged

Add testconfig.json JSON schema for SchemaStore publication#9405
Evangelink merged 1 commit into
mainfrom
evangelink-publish-schema-to-schemastore

Conversation

@Evangelink

Copy link
Copy Markdown
Member

What

Adds a draft-07 JSON Schema for testconfig.json, the configuration file consumed by Microsoft.Testing.Platform (MTP) and MSTest, plus a maintainer doc.

Implements Task 1 of #9381 (publish the MSTest testconfig.json schema to SchemaStore).

Files

  • docs/testconfig.schema.json — the schema. Covers the full mstest:* surface (timeout, execution, parallelism, output, deployment, assemblyResolution, orderTestsByNameInClass), the platformOptions:* host options, and the environmentVariables section. Enums, ranges and per-key descriptions are derived from the actual parsers (MSTestSettings.Configuration.cs, MSTestAdapterSettings.cs, RunConfigurationSettings.cs, PlatformConfigurationConstants.cs).
  • docs/testconfig.schema.md — how to reference the schema, the SchemaStore submission steps, how versioning works (rolling main URL; no in-file version), and a "keep in sync" pointer to the parser source-of-truth files.

Validation

The schema was validated against the canonical testconfig.json example used in the repo's acceptance tests, and confirmed to reject bad enums, sub-minimum timeouts, unknown keys, and missing required path in assemblyResolution.

SchemaStore registration

The companion SchemaStore catalog PR is open: SchemaStore/schemastore#5842. It is a self-hosted/external registration pointing at https://raw.githubusercontent.com/microsoft/testfx/main/docs/testconfig.schema.json, so it only goes green once this PR merges to main and the URL resolves.

Follow-ups

Tasks 2–5 from #9381 are tracked separately: #9402, #9401, #9403, #9404.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 24, 2026 18:46
@Evangelink Evangelink added the state/needs-review Awaiting review from the team. label Jun 24, 2026
@Evangelink
Evangelink enabled auto-merge (squash) June 24, 2026 18:47
@Evangelink
Evangelink merged commit 86aa5a4 into main Jun 24, 2026
14 checks passed
@Evangelink
Evangelink deleted the evangelink-publish-schema-to-schemastore branch June 24, 2026 18:51

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

Adds a draft-07 JSON Schema for testconfig.json (for MSTest + Microsoft.Testing.Platform) plus maintainer documentation intended to support SchemaStore publication and IDE completion/validation.

Changes:

  • Introduces docs/testconfig.schema.json defining the schema for mstest, platformOptions, and environmentVariables.
  • Adds docs/testconfig.schema.md documenting how to reference the schema and how to publish/register it in SchemaStore.
Show a summary per file
File Description
docs/testconfig.schema.json Adds the draft-07 JSON schema for testconfig.json keys and value constraints.
docs/testconfig.schema.md Documents schema usage, SchemaStore registration, and versioning/sync guidance.

Copilot's findings

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

Comment on lines +12 to +24
"mstest": {
"$ref": "#/definitions/mstest"
},
"platformOptions": {
"$ref": "#/definitions/platformOptions"
},
"environmentVariables": {
"type": "object",
"description": "Environment variables to apply to the test host process. Mirrors the <EnvironmentVariables> element of legacy .runsettings. Declaring at least one entry opts the run into the test host controller process model. Do not store secrets here.",
"additionalProperties": {
"type": ["string", "number", "boolean", "null"]
}
}
Comment on lines +122 to +125
"collectSourceInformation": {
"type": "boolean",
"description": "When true, source file and line information is collected during discovery. Defaults to true."
}

@Evangelink Evangelink left a comment

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.

Note

🤖 Automated review by GitHub Copilot. Posted via a maintainer's GitHub token, so it appears under their account — the account owner did not write or approve this content personally. Generated by the Expert Code Review workflow. To request a follow-up action, reply by tagging @copilot directly.

Review summary

All enum values cross-checked against the actual parser code — parallelism.scope, launchDebuggerOnAssertionFailure, and executionApartmentState are all correct. The platformOptions key paths all match PlatformConfigurationConstants. The overall schema structure, $schema dialect, $id URL, and the .md documentation are solid.

One factual correctness issue needs to be fixed before merge:

🔴 MAJOR — collectSourceInformation not wired up in JSON config

mstest.execution.collectSourceInformation is documented as a valid testconfig.json key, but no JSON configuration parser in the codebase reads mstest:execution:collectSourceInformation. A grep across the entire repo shows every occurrence of CollectSourceInformation lives in XML runsettings paths or XML-path code comments. The three JSON parsers invoked for testconfig.jsonMSTestSettings.SetSettingsFromConfig, RunConfigurationSettings.SetRunConfigurationSettingsFromConfig, and MSTestAdapterSettings.ToSettings(IConfiguration) — do not call any ParseBooleanSetting/TryParse on that key. Users who set this in their testconfig.json will get a silent no-op.

Fix: remove the property from the schema (or clearly document it is .runsettings-only) until the JSON-path implementation is in place. Inline comment is left on line 125.

🟡 NIT — includeSubDirectories type union

"type": ["boolean", "string"] leaks how IConfiguration works internally. JSON authors should write true/false; "type": "boolean" is the correct schema type. Inline comment is left on line 193.

"collectSourceInformation": {
"type": "boolean",
"description": "When true, source file and line information is collected during discovery. Defaults to true."
}

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.

MAJOR — collectSourceInformation is not implemented in the JSON config path

collectSourceInformation under mstest.execution is documented here as a valid key, but none of the JSON configuration parsers actually read it:

  • MSTestSettings.SetSettingsFromConfig (the 18-setting switch in MSTestSettings.Configuration.cs) does not call ParseBooleanSetting for execution:collectSourceInformation.
  • RunConfigurationSettings.SetRunConfigurationSettingsFromConfig only reads mstest:execution:executionApartmentState.
  • MSTestAdapterSettings.ToSettings(IConfiguration) only reads the deployment:* and assemblyResolution keys.

A grep of the full codebase confirms all occurrences of CollectSourceInformation are in XML runsettings paths or XML path comments (part of <RunConfiguration>, not <MSTest>), never in a configuration["mstest:execution:collectSourceInformation"] lookup.

A user who adds "collectSourceInformation": false to their testconfig.json will get no effect — the setting will be silently ignored.

Recommendation: Remove this property from the schema until it is wired up in the JSON config path, or add an "x-not-yet-supported": true / note in the description that this key is only honoured when using .runsettings.

},
"includeSubDirectories": {
"type": ["boolean", "string"],
"description": "When true, subdirectories of 'path' are also probed. Defaults to false."

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.

NIT — ["boolean", "string"] union leaks an IConfiguration implementation detail

IConfiguration always surfaces all values as strings internally, so from the configuration layer's perspective true and "true" are indistinguishable. However, from a JSON author's perspective the correct way to express this is a plain JSON boolean:

{ "path": "C:\\foo", "includeSubDirectories": true }

Exposing "type": ["boolean", "string"] implicitly tells tooling that "includeSubDirectories": "true" is also a valid document, which makes schema-driven editors accept "yes" or "1" without complaint (those are strings that would silently fail bool.TryParse).

Recommendation: Use "type": "boolean" only.

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.

3 participants