8000
feat: Add filter support for TestAdapter #2788
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
5. Temporary comment out
IntroVisualStudioProfiler
benchmarkBecause it cause errors when benchmarks are enumerated/evaluated twice. (#2758)
Remaining tasks
dotnet test
by defaultCurrently, it need to specify
--logger:"console;verbosity=normal"
explicitlyIntroVisualStudioProfiler
code when issue is resolved. ([Bug]InvalidOperationException
thrown on some conditions when usingBenchmarkDotNetDiagnosers
#2758)DisplayName
filter is same asFullyQualifiedName
(Currently there is no attribute for DisplayName)TestTfmsInParallel:false
setting onBenchmarkDotNet.TestAdapter
package's props.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