Improve reusable TestCase and Swift Testing integration - #2
Draft
kudit wants to merge 29 commits into
Draft
Conversation
kudit
force-pushed
the
agent/improve-test-infrastructure
branch
from
July 26, 2026 02:08
20d8a11 to
c6c86f1
Compare
Fix test infrastructure availability
Simplified code duplication and context description.
Refactor lastPathComponent to support Windows-style paths and remove Foundation dependency.
Added guidelines for collaborative coding workflow to improve interaction with maintainers.
Added testing requirements and TODOs for release preparation.
This reverts commit d82e8c0.
fix @available where macOS 12 was paired with watchOS 8
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.
What changed
This draft PR keeps the work in two reviewable commits:
Consolidate TestCase execution and preserve diagnostics
execute()and the live-UIrun()path through one lifecycle implementation.awaitinsidedefer..paralleland.serializedexecution modes for tests that mutate process-global state.TestFailure, retaining file, function, line, column, and detailed expectation values..ERRORbefore throwing so command-line runs retain useful diagnostics.Add reusable Swift Testing module adapter
Compatibility Testing Libraryproduct in the same package and.swiftpmproject.ModuleTestEntry, one Swift Testing argument per CompatibilityTestCase.CustomTestStringConvertiblefor readable Xcode names such asDevice › Battery Tests › Reports current battery state.CustomTestArgumentEncodablefor stable argument identity and selective reruns.ModuleTestEntry.entries(including:)andentry.execute().Design decisions
TestCaseremains@MainActorbecause it owns observable UI progress and a mutable test closure. A sendable execution snapshot keeps detached execution safe and prevents the UI model from crossing actors.main {}remains distinct fromawait MainActor.run {}: the former schedules fire-and-forget work, while the latter awaits completion and can return a value.main/background/sleep/WASM overload consolidation belongs to follow-up PR Consolidate threading APIs and add WebAssembly async fallbacks #3.Open draft review items
Before this PR is marked ready for review:
.serializedexecution truly exclusive against both serialized and parallel reusable tests;deferrather than automatically resetting all Compatibility settings around every test;Validation so far
Dependent follow-up
After this API is finalized and released, create a Device pull request that imports
CompatibilityTestingand replaces its duplicatedEntry/module lookup adapter withModuleTestEntry.