Move test-case filter parsing to adapter boundary (Phase 6d-1)#9591
Draft
Evangelink wants to merge 1 commit into
Draft
Move test-case filter parsing to adapter boundary (Phase 6d-1)#9591Evangelink wants to merge 1 commit into
Evangelink wants to merge 1 commit into
Conversation
Move TestMethodFilter (and its nested TestElementFilter) out of MSTestAdapter.PlatformServices up into MSTest.TestAdapter, and inject the neutral ITestElementFilter into the engine and discoverer via a new ITestElementFilterProvider abstraction. - New neutral ITestElementFilterProvider (PlatformServices.Interface): the boundary builds it (TestElementFilterProvider, closing over the VSTest IRunContext/IDiscoveryContext) and passes it into TestExecutionManager.RunTestsAsync/ExecuteTestsAsync and UnitTestDiscoverer.DiscoverTests. - The engine/discoverer invoke the provider at the EXACT points they previously built the filter (per source), so filter parse-error reporting keeps the same timing and per-source semantics; TestElementFilter.Matches still does element.ToTestCase() (byte-for-byte; #9568 deferred). - This removes ITestCaseFilterExpression / GetTestCaseFilter / MatchTestCase / the VSTest TestProperty filter set from PlatformServices code. IRunContext/IDiscoveryContext remain only for deployment + settings extraction (removed in a follow-up). No behavior change: filtered set/order and the discovery/execution filterHasError bail-out are identical; TestCaseFilteringTests (out-of-proc filter regression net) stays green. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Phase 6d-1 of the PlatformServices platform-agnostic initiative
Part of removing the VSTest object model (
Microsoft.TestPlatform.ObjectModel) dependency fromMSTestAdapter.PlatformServices.This phase moves the test-case filter parsing to the adapter boundary.
TestMethodFilter(which parses the VSTestITestCaseFilterExpressionfromIRunContext/IDiscoveryContext.GetTestCaseFilter) moves out of PlatformServices intoMSTest.TestAdapter, and the engine/discoverer receive an injected neutralITestElementFiltervia a newITestElementFilterProviderabstraction.What changed
ITestElementFilterProvider(PlatformServices.Interface):ITestElementFilter? GetTestElementFilter(IAdapterMessageLogger, out bool filterHasError).TestMethodFilter(+ nestedTestElementFilter) →MSTest.TestAdapter(class body byte-identical); added a boundaryTestElementFilterProviderthat closes over the VSTest context.MSTestExecutor,MSTestDiscoverer— which the MTPMSTestBridgedTestFrameworkalso routes through) buildsnew TestElementFilterProvider(context)and injects it intoTestExecutionManager.RunTestsAsync/ExecuteTestsAsyncandUnitTestDiscoverer.DiscoverTests.No behavior change
TestElementFilter.Matchesstill doeselement.ToTestCase()(byte-for-byte; the #9568 no-round-trip optimization is deferred as its own follow-up). This removesITestCaseFilterExpression/GetTestCaseFilter/MatchTestCase/ the VSTest filterTestPropertyset from PlatformServices code.IRunContext/IDiscoveryContextremain only for deployment + settings extraction (removed in 6d-2).Verification
MSTestAdapter.PlatformServices.UnitTests: 897 (net8.0) / 935 (net462);MSTestAdapter.UnitTests: 21;MSTest.IntegrationTests: 47 pass / 1 skip — includingTestCaseFilteringTests, the out-of-proc filter regression net.Base / stacking
dev/amauryleve/vstest-decoupling-settings; review/merge after Neutralize run-settings input in PlatformServices host layer (Phase 6c2) #9590. When 6c2 merges intovstest-decoupling-base, this PR is rebased onto the updated base (diff is 6d-1 only, 10 files).Remaining work
IRunContext/IDiscoveryContextfrom PlatformServices entirely (deploy-context + settings extraction to the boundary).UnitTestElement↔TestCaseconversion +EngineConstants.Microsoft.TestPlatform.ObjectModelPackageReference + guard test.