Skip to content

feat: emit public TestMethodIdentifierProperty and stop advertising vstestProvider#284

Merged
Alxandr merged 3 commits into
YoloDev:mainfrom
Evangelink:mtp-emit-public-properties-drop-vstestprovider
Jul 1, 2026
Merged

feat: emit public TestMethodIdentifierProperty and stop advertising vstestProvider#284
Alxandr merged 3 commits into
YoloDev:mainfrom
Evangelink:mtp-emit-public-properties-drop-vstestprovider

Conversation

@Evangelink

@Evangelink Evangelink commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

⚠️ Draft / proposal for discussion — see #283 for the full background.

What

Emit the public TestMethodIdentifierProperty from the Expecto adapter and stop advertising the Microsoft.Testing.Platform vstestProvider capability, so Visual Studio Test Explorer consumes the public structured node properties instead of the legacy vstest.TestCase.* key/value-pair properties.

Why

When the adapter advertises vstestProvider, VS routes Expecto through a legacy parser that reads vstest.TestCase.* properties, serialized via Microsoft.Testing.Platform''s internal SerializableKeyValuePairStringProperty key/value bag. The testfx team is deprecating that internal type in favor of public property types. MSTest already moved off this path; NUnit and Expecto are the last two adapters using it (companion NUnit PR: nunit/nunit3-vs-adapter#1456).

How

  1. adapter.fs — override AddAdditionalProperties to emit a TestMethodIdentifierProperty (serialized as location.type / location.method). Expecto tests are values in nested lists, not CLR methods, so this is synthesized from the dot-joined FullyQualifiedName.
  2. TestApplicationHelpers.fs — replace VSTestBridgeExtensionBaseCapabilities (which also implements INamedFeatureCapability("vstestProvider")) with a small capability implementing only the public ITrxReportCapability. Mirrors MSTest''s MSTestCapabilities.
  3. Directory.Packages.props — bump Microsoft.Testing.* from 1.9.1 to 2.2.3. The AddAdditionalProperties virtual hook on the bridge base type is newer than 1.9.1, so the override does not compile against 1.9.1.

Builds clean (net8.0).

Open questions / please review before this leaves draft

  • Type/method synthesis (adapter.fs): the FullyQualifiedName is split on the last . into location.type / location.method. This assumes the default --join-with .; with --join-with / the split is wrong. There may be a better mapping from Expecto''s test hierarchy — your call.
  • Package bump (1.9.1 → 2.2.3): flagging in case you were intentionally pinned to 1.x.

Identity & sequencing (important)

This change is the right direction but should be sequenced with the VS Test Explorer side, not landed in isolation:

  • Per-test identity moves from the legacy vstest.TestCase.Id GUID to the public TestNode.Uid. Expecto''s FullyQualifiedName is already a unique per-test path, so the synthesized location.type/location.method preserves per-test identity reasonably well (better than the NUnit method-parameterized case) — but it remains a heuristic split.
  • vstest.original-executor-uri is dropped (the bridge only emits it under vstestProvider). It is used for framework identity (e.g. "Associate to Test Case"). This is at parity with MSTest, which already runs without it on the public path; if a framework-identity feature depends on it, that is a shared testfx gap (needs a public identity property), not Expecto-specific.
  • TRX enrichment becomes always-on with the public ITrxReportCapability (the internal on-demand gate isn''t available to external adapters). Harmless on the server-mode wire.

Please coordinate with the VS Test Explorer team so navigation / grouping / Test Case association don''t regress before vstestProvider is fully dropped.

Refs #283

@Alxandr

Alxandr commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

This relates to #282 I imagine? The failures in CI are the same at least.

@Alxandr

Alxandr commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Would you update this to latest main and resolve the conflicts? I would like to see CI pass before taking a deeper look at what's actually changed/how the changes work.

…testProvider

Emit the public TestMethodIdentifierProperty (location.type/method) from AddAdditionalProperties and replace VSTestBridgeExtensionBaseCapabilities with an ITrxReportCapability-only capability so the vstestProvider capability is no longer advertised. VS Test Explorer then consumes the public location.* properties instead of the legacy vstest.TestCase.* key/value-pair properties (Microsoft.Testing.Platform's internal SerializableKeyValuePairStringProperty). Mirrors MSTest's MSTestCapabilities. Requires bumping Microsoft.Testing.* from 1.9.1 to 2.2.3 because the AddAdditionalProperties hook is newer than 1.9.1.

Refs YoloDev#283
@Evangelink Evangelink force-pushed the mtp-emit-public-properties-drop-vstestprovider branch from 23fae6c to bbd99df Compare June 30, 2026 09:00
…eException

The skipped-test printer added a TestResultMessage with AdditionalInfoCategory.
The Microsoft.Testing.Platform VSTest bridge (2.x) only converts StandardError/
StandardOut/DebugTrace message categories when building the TRX report and throws
UnreachableException on any other category. Once the adapter stops advertising the
vstestProvider capability (this PR), result conversion goes through that TRX path,
so a skipped test crashed the whole MTP run under 'dotnet test'.

Set TestResult.ErrorMessage instead: the bridge maps it to SkippedTestNodeStateProperty
and the legacy VSTest runner shows it as the skip reason, so the reason is preserved
on both paths without the unsupported message category.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@Evangelink Evangelink marked this pull request as ready for review June 30, 2026 11:52
@Evangelink

Copy link
Copy Markdown
Contributor Author

@Alxandr PR is ready.

Comment thread src/YoloDev.Expecto.TestSdk/TestApplicationHelpers.fs Outdated
Addresses review feedback: the MSTestCapabilities reference pointed at a
moving target (the testfx main branch). Pin it to commit
5c6ea3bf01f1247736fbbbba0ffdd8a8b38840dc so the cited code can't drift.

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

Alxandr commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

This should be considered a breaking change I imagein?

@Evangelink

Copy link
Copy Markdown
Contributor Author

This should be considered a breaking change I imagein?

It should not have any perceiptible impact. Before we were using the test case info we were converting at bridge level, now we are declaring directly but using the same mechanism.

Actually, I can only think of it being a break for VS 2022

@Alxandr

Alxandr commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

You have to create/update a global.json, no?

@Evangelink

Copy link
Copy Markdown
Contributor Author

You have to create/update a global.json, no?

Right. Indeed, for NET 10+ it's the case. I am kinda thinking this is .NET breaking change but it's all good if you make it breaking change on your side.

@Alxandr Alxandr changed the title MTP: emit public TestMethodIdentifierProperty and stop advertising vstestProvider feat: emit public TestMethodIdentifierProperty and stop advertising vstestProvider Jul 1, 2026
@Alxandr Alxandr merged commit 4597e35 into YoloDev:main Jul 1, 2026
7 checks passed
@Alxandr

Alxandr commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Is this ready to be released immediately, or should I wait for something?

@Evangelink

Copy link
Copy Markdown
Contributor Author

It's ready!

@Evangelink Evangelink deleted the mtp-emit-public-properties-drop-vstestprovider branch July 1, 2026 11:11
@Evangelink

Copy link
Copy Markdown
Contributor Author

Actually, I will probably release 2.3 today so you may want to wait for that.

@Alxandr

Alxandr commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Ok. Just poke me when you want this released.

@Evangelink

Copy link
Copy Markdown
Contributor Author

Getting some localization issues. I'll wait an extra day and release tomorrow evening.

@Alxandr

Alxandr commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

@Evangelink ?

@Evangelink

Copy link
Copy Markdown
Contributor Author

Thanks for the ping, I was waiting to complete MSTest to ping you but MTP 2.3.0 is shipped so you can bump and release.

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.

2 participants