feat: prevent test runner from halting on XCTest internal failures#41
Conversation
…DA PR #664) swizzles XCTIssue.shouldInterruptTest to always return NO so internal xctest failures during testmanagerd startup don't kill the runner. also disables shouldHaltWhenReceivesControl to handle slow testmanagerd connections, and swallows XCTest issues via record(_:) override.
WalkthroughThis pull request modifies test execution behavior across two files. In the Objective-C category file, a new helper method 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Review rate limit: 3/5 reviews remaining, refill in 21 minutes and 29 seconds. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
DeviceKitTests/Categories/XCUIApplicationProcess+FBQuiescence.m (1)
170-176: 💤 Low valueConsider adding a log statement for traceability.
The quiescence method swizzle logs a message when the method isn't found (line 198-199). Adding similar logging for the XCTIssue swizzle would aid debugging if this mechanism silently fails on a future iOS version.
📝 Suggested change
SEL shouldInterruptTest = NSSelectorFromString(@"shouldInterruptTest"); Method m = class_getInstanceMethod(NSClassFromString(@"XCTIssue"), shouldInterruptTest); if (m) { method_setImplementation(m, (IMP)dk_swizzledShouldInterruptTest); + [FBLogger log:@"Swizzled -[XCTIssue shouldInterruptTest] to return NO"]; + } else { + [FBLogger log:@"Could not find method -[XCTIssue shouldInterruptTest]"]; }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@DeviceKitTests/Categories/XCUIApplicationProcess`+FBQuiescence.m around lines 170 - 176, The XCTIssue swizzle block (using SEL shouldInterruptTest, class_getInstanceMethod(NSClassFromString(@"XCTIssue"), shouldInterruptTest), method_setImplementation and dk_swizzledShouldInterruptTest) should emit a trace log like the quiescence swizzle does: add a log when the method is not found and a log when the swizzle was applied successfully (or when it failed), using the same logging mechanism used elsewhere in this file (e.g., NSLog or the existing test logger) so future iOS changes are detectable.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@DeviceKitTests/Categories/XCUIApplicationProcess`+FBQuiescence.m:
- Around line 170-176: The XCTIssue swizzle block (using SEL
shouldInterruptTest, class_getInstanceMethod(NSClassFromString(@"XCTIssue"),
shouldInterruptTest), method_setImplementation and
dk_swizzledShouldInterruptTest) should emit a trace log like the quiescence
swizzle does: add a log when the method is not found and a log when the swizzle
was applied successfully (or when it failed), using the same logging mechanism
used elsewhere in this file (e.g., NSLog or the existing test logger) so future
iOS changes are detectable.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: dca3460c-aa80-42f7-8ba9-2a0217a38b15
📒 Files selected for processing (2)
DeviceKitTests/Categories/XCUIApplicationProcess+FBQuiescence.mDeviceKitTests/devicekit_iosUITests.swift
No description provided.