Skip to content

perf: skip TestMethodIdentifierProperty for in-progress test nodes#9867

Open
Evangelink wants to merge 2 commits into
mainfrom
dev/amauryleve/skip-testmethodidentifier-in-progress
Open

perf: skip TestMethodIdentifierProperty for in-progress test nodes#9867
Evangelink wants to merge 2 commits into
mainfrom
dev/amauryleve/skip-testmethodidentifier-in-progress

Conversation

@Evangelink

Copy link
Copy Markdown
Member

Goal and rationale

In the native MTP path (MSTestTestNodeConverter), AddTestMethodIdentifier is called for every node type: discovered, in-progress, and result. This method calls ManagedNameParser.ParseManagedMethodName, which parses the managed method name string and allocates a string[] parameterTypes and a TestMethodIdentifierProperty object.

In-progress nodes are "test started" signals — no consumer reads TestMethodIdentifierProperty from them. IDEs (VS Test Explorer) and reporters already hold the full test identity from the discovery node. Skipping this allocation for in-progress nodes eliminates ~1⁄3 of all ParseManagedMethodName calls per test run.

Approach

Added an addMethodIdentifier parameter (default true) to CreateBaseTestNode. ToInProgressTestNode passes addMethodIdentifier: false; discovered and result nodes are unaffected.

Trade-offs

  • In-progress nodes no longer carry TestMethodIdentifierProperty. Any extension that reads this property from in-progress events would need to switch to the discovery event instead (which is the correct place for structural metadata).
  • Discovery and result nodes are unaffected — full identity remains available everywhere it matters.

Test Status

  • Product code: .\build.cmdBuild succeeded, 0 warnings, 0 errors

Fixes #9864

In the native MTP path, AddTestMethodIdentifier (which calls ManagedNameParser.ParseManagedMethodName and allocates a TestMethodIdentifierProperty + string[]) is called for every node type: discovered, in-progress, and result.

In-progress nodes are 'test started' signals -- no consumer reads TestMethodIdentifierProperty from them (IDEs already have the full identity from the discovery node). Skipping this parse for in-progress nodes eliminates ~1/3 of all ParseManagedMethodName calls.

Fixes #9864

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 2f277e70-6fc7-472a-a46f-f7746f505a97
Copilot AI review requested due to automatic review settings July 11, 2026 20:14

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

Optimizes native MTP test-start events by omitting unused method-identifier metadata.

Changes:

  • Adds an opt-out flag when creating base test nodes.
  • Skips method-name parsing for in-progress nodes.
  • Preserves discovery and result node behavior.
Show a summary per file
File Description
MSTestTestNodeConverter.cs Avoids creating method identifiers for in-progress nodes.

Review details

  • Files reviewed: 1/1 changed files
  • Comments generated: 1
  • Review effort level: Medium

@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

Review by Copilot — workflow run

Overall: Clean, well-scoped performance optimization. The change is minimal, correct, and well-documented in the inline comment.

Correctness ✅ — The boolean parameter with default: true ensures discovery and result nodes are unaffected. Only ToInProgressTestNode opts out.

Design ✅ — Using a defaulted parameter keeps the diff small and avoids a breaking change to the internal API signature. The call site is self-documenting with the named argument addMethodIdentifier: false.

Trade-off acknowledgment ✅ — The PR description correctly notes that extensions reading TestMethodIdentifierProperty from in-progress events would break. This is acceptable since no known consumer does so, and the property remains on discovery/result nodes.

No issues found — LGTM.

@Evangelink Evangelink added the state/needs-review Awaiting review from the team. label Jul 11, 2026
…de keeps it

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 2f277e70-6fc7-472a-a46f-f7746f505a97
Copilot AI review requested due to automatic review settings July 11, 2026 20:23

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.

Review details

  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Medium

Comment on lines +50 to +54
// Skip AddTestMethodIdentifier: no consumer reads TestMethodIdentifierProperty from
// in-progress nodes (IDEs and reporters already hold the full identity from the discovery
// node). Skipping it avoids a ManagedNameParser.ParseManagedMethodName parse and the
// associated TestMethodIdentifierProperty / string[] allocation for every started test.
TestNode testNode = CreateBaseTestNode(element, isTrxEnabled, displayNameOverride: null, addMethodIdentifier: false);
@github-actions

Copy link
Copy Markdown
Contributor

🧪 Test quality grade — PR #9867

GradeTestNotes
A (90–100) new MSTestTestNodeConverterTests.
ToInProgressTestNode_
DoesNotAddTestMethodIdentifier_
EvenWithValidManagedNames
Clean absence assertion with an explanatory comment; clear AAA, single focused behavior. No issues found.
A (90–100) new MSTestTestNodeConverterTests.
ToResultTestNode_
AddsTestMethodIdentifier_
FromManagedNames
NotBeNull guard plus three equality assertions on Namespace, TypeName, and MethodName — consider also asserting AssemblyFullName and ReturnTypeFullName as the sibling discovery test does.

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

🤖 Automated content by GitHub Copilot. Generated by the Grade Tests on PR (on open / sync) workflow. · 44.3 AIC · ⌖ 4.9 AIC · ⊞ 9.6K · [◷]( · )

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.

[perf-improver] perf: skip TestMethodIdentifierProperty for in-progress test nodes

3 participants