testfx icon indicating copy to clipboard operation
testfx copied to clipboard

Treenode Filtering not working with All Nodes Wildcard `/**`

Open thomhurst opened this issue 1 year ago • 0 comments

I'm not sure if I'm doing something wrong, but according to this, it should work: https://github.com/microsoft/testfx/blob/main/docs/mstest-runner-graphqueryfiltering/graph-query-filtering.md

Here's my CLI input and output:

With all nodes wildcard:

PS C:\git\TUnit\TUnit.TestProject> dotnet run --treenode-filter /**[MyKey=MyDynamicallyAddedValue] --no-restore -f net8.0

████████╗██╗   ██╗███╗   ██╗██╗████████╗
╚══██╔══╝██║   ██║████╗  ██║██║╚══██╔══╝
   ██║   ██║   ██║██╔██╗ ██║██║   ██║
   ██║   ██║   ██║██║╚██╗██║██║   ██║
   ██║   ╚██████╔╝██║ ╚████║██║   ██║
   ╚═╝    ╚═════╝ ╚═╝  ╚═══╝╚═╝   ╚═╝

   TUnit v1.0.0.0 | 64-bit | Microsoft Windows 10.0.22631 | win-x64 | .NET 8.0.8 | Microsoft Testing Platform v1.4.1


Test run summary: Zero tests ran - bin\Debug\net8.0\TUnit.TestProject.dll (net8.0|x64)
  total: 0
  failed: 0
  succeeded: 0
  skipped: 0
  duration: 223ms

PS C:\git\TUnit\TUnit.TestProject>

Specifying class name:

PS C:\git\TUnit\TUnit.TestProject> dotnet run --treenode-filter /*/*/FilterByDynamicAddedPropertyTests/*[MyKey=MyDynamicallyAddedValue] --no-restore -f net8.0

████████╗██╗   ██╗███╗   ██╗██╗████████╗
╚══██╔══╝██║   ██║████╗  ██║██║╚══██╔══╝
   ██║   ██║   ██║██╔██╗ ██║██║   ██║
   ██║   ██║   ██║██║╚██╗██║██║   ██║
   ██║   ╚██████╔╝██║ ╚████║██║   ██║
   ╚═╝    ╚═════╝ ╚═╝  ╚═══╝╚═╝   ╚═╝

   TUnit v1.0.0.0 | 64-bit | Microsoft Windows 10.0.22631 | win-x64 | .NET 8.0.8 | Microsoft Testing Platform v1.4.1


Test run summary: Passed! - bin\Debug\net8.0\TUnit.TestProject.dll (net8.0|x64)
  total: 31
  failed: 0
  succeeded: 31
  skipped: 0
  duration: 285ms

PS C:\git\TUnit\TUnit.TestProject>

As you can see, the filter doesn't match when using the double asterix wildcard?

Filter match returns false:

Image

The path I build/pass to the filter service is: /TUnit.TestProject/TUnit.TestProject/FilterByDynamicAddedPropertyTests/Test1

And the property bag contains: KeyValuePairStringProperty { Key = MyKey, Value = MyDynamicallyAddedValue }

thomhurst avatar Oct 11 '24 19:10 thomhurst