-
-
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
base: master
Are you sure you want to change the base?
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: |
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.cs
Remove 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 out
IntroVisualStudioProfiler
benchmarkBecause it cause errors when benchmarks are enumerated/evaluated twice. (#2758)
Remaining tasks
IntroVisualStudioProfiler
code when issue is resolved. ([Bug]InvalidOperationException
thrown on some conditions when usingBenchmarkDotNetDiagnosers
#2758)TestTfmsInParallel:false
setting onBenchmarkDotNet.TestAdapter
package's props.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
Release
configuration.dotnet test
--filter
parameterpartial query
works as expected.property value
works as expected.Category
works as expected