-
- Notifications
You must be signed in to change notification settings - Fork 1k
feat: Add filter support for TestAdapter #2788
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add filter support for TestAdapter #2788
Conversation
In the original PR, not including Debug without in-process was on purpose. See comment chain #2438 (comment). We decided to leave it as a future improvement to include debugger attachment. I think that should be done in a separate PR. |
Thanks for pointed out it's expected behavior that display only InProcess jobs on Debug configuration. |
| I've added commit(8551dbf) to resolve issue console logs are outputted twice. It use reflection to modify ImmutableConfig's logger field with following reasons
When it failed to get logger fields of ImmutableConfig. It skip steps to remove ConsoleLogger. |
| Is that related to filter? Can it be done in a separate PR? Also, I don't like using reflection to do that. We can instead construct a new config object, copying all the properties except ones we want to exclude. We can also add APIs to |
So it might better to create separated PR. |
e89ded7 to 2391e11 Compare | I've added commit (2391e11) It set Note: |
2391e11 to dd4ac03 Compare dd4ac03 to d2af178 Compare d6b203a to 553522c Compare samples/BenchmarkDotNet.Samples.FSharp/BenchmarkDotNet.Samples.FSharp.fsproj Show resolved Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @filzrev!
This PR add
--filterparameter support fordotnet test.It intended to resolve #2767 issue (and some part of issue #2662)
What's changed in this PR.
1. Add benchmark filter logics
Add following files to support benchmark filtering.
TestCaseFilter.csLoggerHelper.csNote: These files are based on xUnit v2 TestAdapter Code (License: Apache 2.0)
2. Modify
VSTestAdapter.csAdd benchmark filter logics to
DiscoverTestsandRunTests3. BenchmarkEnumerator.csRemove code forDebugconfiguration.(By #2774 changes. It can load DLLs that are build withDebugconfigurations)4. Disable
TestTfmsInParallelMSBuild propertyIt's enabled by default on .NET 9 or later.
But it's not expected multiple benchmarks are executed in parallel.
I've added code to disable this setting to following files.
BenchmarkDotNet.Samples.csprojBenchmarkDotNet.Samples.FSharp.csprojBenchmarkDotNet.TestAdapter/build/BenchmarkDotNet.TestAdapter.props5. Temporary comment outIntroVisualStudioProfilerbenchmarkBecause it cause errors when benchmarks are enumerated/evaluated twice. (#2758)Tasks that is not scope of this PR
dotnet testby default-> It need to specify
--logger:"console;verbosity=normal"explicitlyDisplayNamefilter is same asFullyQualifiedName-> Currently there is no attribute that can be used for DisplayName
What's Tested
Currently it's hard to write unit tests that use TestAdapter.
So it need to run tests manually.
TestExplorer
1. All benchmarks(net462/net80) are displayed when usingReleaseconfiguration.dotnet test--filterparameterpartial queryworks as expected.property valueworks as expected.Categoryworks as expected