Skip to content

Commit 649265b

Browse files
test: Skip AppHangTracking when debugger attached (#6242)
Skip the testResumeAndPauseAppHangTracking when a debugger is attached to avoid confusion. Co-authored-by: Philip Niedertscheider <[email protected]>
1 parent 7dabfb9 commit 649265b

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Tests/SentryTests/SentrySDKInternalTests.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -609,6 +609,10 @@ class SentrySDKInternalTests: XCTestCase {
609609

610610
@available(*, deprecated, message: "This is deprecated because SentryOptions integrations is deprecated")
611611
func testResumeAndPauseAppHangTracking() throws {
612+
if SentryDependencyContainer.sharedInstance().crashWrapper.isBeingTraced {
613+
throw XCTSkip("This test only works when the debugger is NOT attached, because it requires the SentryANRTrackingIntegration being installed, which the SDK only installs if the debugger is not attached.")
614+
}
615+
612616
SentrySDK.start { options in
613617
options.dsn = SentrySDKInternalTests.dsnAsString
614618
options.setIntegrations([SentryANRTrackingIntegration.self])
@@ -626,11 +630,7 @@ class SentrySDKInternalTests: XCTestCase {
626630
SentrySDK.resumeAppHangTracking()
627631
Dynamic(anrTrackingIntegration).anrDetectedWithType(SentryANRType.unknown)
628632

629-
if SentryDependencyContainer.sharedInstance().crashWrapper.isBeingTraced {
630-
XCTAssertEqual(0, client.captureEventWithScopeInvocations.count)
631-
} else {
632-
XCTAssertEqual(1, client.captureEventWithScopeInvocations.count, "The SDK should capture an AppHang after resuming the tracking, but it didn't.")
633-
}
633+
XCTAssertEqual(1, client.captureEventWithScopeInvocations.count, "The SDK should capture an AppHang after resuming the tracking, but it didn't.")
634634
}
635635

636636
@available(*, deprecated, message: "This is deprecated because SentryOptions integrations is deprecated")

0 commit comments

Comments
 (0)