Swift testing timeouts not respected in XCTestPlan
tools integrationdarwin
Please correct me if I'm wrong but it seems like Swift Testing does not respect XCTestPlan timeouts and lacks global default timeout configuration
### Summary
Swift Testing tests (`@Test`, `@Suite`) do not appear to respect timeout settings configured via `.xctestplan` (for example, "Test Timeouts Enabled" and "Maximum Test Execution Time Allowance").
Additionally, there does not seem to be a way to configure a global default timeout for Swift Testing tests via Xcode or `xcodebuild`, unlike XCTest.
### Reproduction
1. Create a test plan with:
- Test Timeouts Enabled = YES
- Maximum Test Execution Time Allowance = 60 seconds
2. Add a Swift Testing test that never completes:
```swift
@Test
func hangingTest() async throws {
await withCheckedContinuation { _ in
// never resumes
}
}
```
3. Run via Xcode or `xcodebuild`.
### Expected
The test should be terminated after the configured timeout (for example, 60 seconds).
### Actual
The test runs indefinitely and is not terminated.
In CI, the entire job eventually fails only when the outer job timeout is reached.
### Impact
- Hanging tests can block CI for extended periods (for example, 120 minutes)
- There does not appear to be an equivalent of XCTest’s global timeout enforcement
- This requires manually adding `.timeLimit(...)` to every suite or test
### Questions
- Is there an intended way to configure a global default timeout for Swift Testing?
- Should Swift Testing respect `.xctestplan` timeout settings, or is this by design?
- Are there plans to expose timeout configuration at the runner or CLI level?
### Notes
Suite-level `.timeLimit(...)` works, but this requires manual adoption across all test code and is easy to miss during migration from XCTest.
关闭于 2026-04-18 2 条评论