Skip to content

Expose test arguments as filterable properties#5519

Open
SimonCropp wants to merge 3 commits intothomhurst:mainfrom
SimonCropp:Expose-test-arguments-as-filterable-properties
Open

Expose test arguments as filterable properties#5519
SimonCropp wants to merge 3 commits intothomhurst:mainfrom
SimonCropp:Expose-test-arguments-as-filterable-properties

Conversation

@SimonCropp
Copy link
Copy Markdown
Contributor

Parameterized tests can now be filtered by their resolved argument
values via --treenode-filter, e.g.:

  --treenode-filter "/*/*/MyTests/*[arg0=*foo*]"

TestBuilder.InvokeDiscoveryEventReceiversAsync stringifies each entry
in TestDetails.TestMethodArguments and adds it to the DiscoveredTestContext
as arg0, arg1, ... so it flows into the existing property bag used by
the filter matcher. Wildcards in the value are supported by the platform's
built-in matcher.

@codacy-production
Copy link
Copy Markdown

codacy-production Bot commented Apr 12, 2026

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity

Metric Results
Complexity 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@thomhurst
Copy link
Copy Markdown
Owner

Just to avoid redundant work for those who don't need this, and also to not interfere with any possibilities of users having explicitly set these, can we wrap them in a feature flag that the user can control? I added settings functionality in #5522

I'm thinking maybe something like:

[Before(HookType.TestDiscovery)]
public static void Configure(BeforeTestDiscoveryContext context)
{
    context.Settings.Metadata.EnableArgumentProperties = true;
}

@thomhurst
Copy link
Copy Markdown
Owner

Also should this work with class constructors too?

@SimonCropp
Copy link
Copy Markdown
Contributor Author

Also should this work with class constructors too

for my purposes, i dont need it

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines:
1 pipeline(s) were filtered out due to trigger conditions.

  Parameterized tests can now be filtered by their resolved argument
  values via `--treenode-filter`, e.g.:

      --treenode-filter "/*/*/MyTests/*[arg0=*foo*]"

  TestBuilder.InvokeDiscoveryEventReceiversAsync stringifies each entry
  in TestDetails.TestMethodArguments and adds it to the DiscoveredTestContext
  as arg0, arg1, ... so it flows into the existing property bag used by
  the filter matcher. Wildcards in the value are supported by the platform's
  built-in matcher.
@thomhurst thomhurst force-pushed the Expose-test-arguments-as-filterable-properties branch from b715cf4 to d176ec6 Compare April 26, 2026 11:37
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