-
-
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!
Updated [BenchmarkDotNet](https://github.com/dotnet/BenchmarkDotNet) from 0.15.2 to 0.15.3. <details> <summary>Release notes</summary> _Sourced from [BenchmarkDotNet's releases](https://github.com/dotnet/BenchmarkDotNet/releases)._ ## 0.15.3 Full changelog: https://benchmarkdotnet.org/changelog/v0.15.3.html ## Highlights Improvements: - Naot instruction set support for .NET 10+, migrate to ISA groupings in CPU summary [#2828](dotnet/BenchmarkDotNet#2828) - Support benchmark filtering for TestAdapter [#2662](dotnet/BenchmarkDotNet#2662) [#2788](dotnet/BenchmarkDotNet#2788) - Support non-primitive external types in `ArgumentsSource` [#2820](dotnet/BenchmarkDotNet#2820) - Enable MSBuild parallel build via `--nodeReuse:false` [#2693](dotnet/BenchmarkDotNet#2693) [#2814](dotnet/BenchmarkDotNet#2814) - Improve CPU detection [#2747](dotnet/BenchmarkDotNet#2747) [#2749](dotnet/BenchmarkDotNet#2749) - Enable assembly signing for debug build [#2774](dotnet/BenchmarkDotNet#2774) Deprecations: - Deprecated `WithNuget` [#2812](dotnet/BenchmarkDotNet#2812) Bug fixes: - Fix `InvalidOperationException` in diagnosers [#2758](dotnet/BenchmarkDotNet#2758) [#2805](dotnet/BenchmarkDotNet#2805) - Fix file detection in `NativeMemoryProfiler` [#2794](dotnet/BenchmarkDotNet#2794) [#2795](dotnet/BenchmarkDotNet#2795) - Fix long file paths issue in `EtwProfiler` [#2807](dotnet/BenchmarkDotNet#2807) [#2808](dotnet/BenchmarkDotNet#2808) - Fix log duplications in TestAdapter [#2790](dotnet/BenchmarkDotNet#2790) - Fix x86 disassembler error for net462 [#2792](dotnet/BenchmarkDotNet#2792) - Fix `IsNetCore` and `IsNativeAOT` for single-file apps without AOT [#2799](dotnet/BenchmarkDotNet#2799) - Fix density plot generation in `RPlotExporter` for latest version of R [#2809](dotnet/BenchmarkDotNet#2809) Commits viewable in [compare view](dotnet/BenchmarkDotNet@v0.15.2...v0.15.3). </details> [](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details> Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This PR add
--filter
parameter 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.cs
LoggerHelper.cs
Note: These files are based on xUnit v2 TestAdapter Code (License: Apache 2.0)
2. Modify
VSTestAdapter.cs
Add benchmark filter logics to
DiscoverTests
andRunTests
3. BenchmarkEnumerator.csRemove code forDebug
configuration.(By #2774 changes. It can load DLLs that are build withDebug
configurations)4. Disable
TestTfmsInParallel
MSBuild 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.csproj
BenchmarkDotNet.Samples.FSharp.csproj
BenchmarkDotNet.TestAdapter/build/BenchmarkDotNet.TestAdapter.props
5. Temporary comment outIntroVisualStudioProfiler
benchmarkBecause it cause errors when benchmarks are enumerated/evaluated twice. (#2758)Tasks that is not scope of this PR
dotnet test
by default-> It need to specify
--logger:"console;verbosity=normal"
explicitlyDisplayName
filter 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 usingRelease
configuration.dotnet test
--filter
parameterpartial query
works as expected.property value
works as expected.Category
works as expected