Thanks for being a part of WWDC25!

How did we do? We’d love to know your thoughts on this year’s conference. Take the survey here

Detect issues like logic failures, UI problems, and performance regressions by running tests on your app.

Posts under Testing tag

107 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

SwiftMacros Not able to access of main project XCTest File.
I have developed a Swift macro called @CodableInit in the SwiftCodableMacro module, and I’m able to use it successfully in my main project. Here’s an example usage: import SwiftCodableMacro @CodableInit // This is for Codable macros public class ErrorMonitoringWebPlugin { public var identifier: UUID = UUID() // MARK: - Codable required public init(from decoder:Decoder) throws { let values = try decoder.container(keyedBy: CodingKeys.self) identifier = try values.decode(UUID.self, forKey: .identifier) } } However, when I try to write a unit test for the ErrorMonitoringWebPlugin class, I encounter an issue. Here's the test case: func testCodableSubjectIdentifierShouldEqualDecodedSubjectIdentifier() { self.measure { let encoder = JSONEncoder() let data = try? encoder.encode(subject) //Here I am getting this error Class 'JSONEncoder' requires that 'ErrorMonitoringWebPlugin' conform to 'Encodable' let decoder = JSONDecoder() let decodedSubject = try? decoder.decode(ErrorMonitoringWebPlugin.self, from: data!) XCTAssertEqual(subject.identifier, decodedSubject?.identifier) } } The compiler throws an error saying: Class 'JSONEncoder' requires that 'ErrorMonitoringWebPlugin' conform to 'Encodable' Even though the @CodableInit macro is supposed to generate conformance, it seems that this macro-generated code is not visible or active inside the test target. How can I ensure that the @CodableInit macro (from SwiftCodableMacro) is correctly applied and recognized within the XCTest target of my main project?
0
0
20
20h
The UT coverage does not include branch coverage for swift
We using below command to run unit test and collect coverage: xcodebuild -workspace Demo.xcworkspace -scheme VideoTests -configuration Debug -derivedDataPath ../build/derivedData -destination 'platform=iOS Simulator,id=E6630007-570B-4DEB-A023-2BCE91116A8D' -resultBundlePath './fastlane/test_output/VideoTests.xcresult' -enableCodeCoverage YES -testPlan 'Video' test-without-building | tee '/Users/rcadmin/Library/Logs/scan/VideoTests.log' | xcbeautify -q --is-ci and using xcrun llvm-cov show command to generate coverage report: xcrun llvm-cov show /build/unit-test/coverage/libraries/merged/video.o -instr-profile=/app/ios/build/derivedData/Build//ProfileData/E6630007-570B-4DEB-A023-2BCE91116A8D/video.profdata -show-branches count -show-expansions -show-line-counts -use-color -format=html -output-dir coverage and the html report does not include branch coverage: how to generate the branch coverage?
0
0
65
3w
Adding capability causes Xcode Cloud testing to fail
My app is approved for the Web Browser Public Key Credential Request managed capability and has it added to its App ID Configuration: It has been added to my entitlements file: I am able to build and run unit tests in Xcode locally using my managed profile. When I push changes and Xcode Cloud tries to build and run the app, I get the following error: Mirrai encountered an error (Failed to install or launch the test runner. (Underlying Error: Could not launch “MirraiTests”. Runningboard has returned error 5. Please check the system logs for the underlying cause of the error. (Underlying Error: The operation couldn’t be completed. Launch failed. (Underlying Error: Launchd job spawn failed)))) Removing just the com.apple.developer.web-browser.public-key-credential entitlement, with no other changes, results in all tests passing on Xcode Cloud. Some thoughts: In project settings, the test target has a different bundle id (appending Tests to the app bundle id). Under "Certificates, Identifiers & Profiles," the managed capability is added to the bundle id but it is an explicit bundle id and not a wildcard. Do I need to apply for the managed capability for the test bundle id as well? Or for a wildcard bundle id? xcodebuild-test-without-building.log
2
0
69
1w
Xcode Cloud MacOS app with restricted capability - cannot run tests
Xcode Cloud is unable to run unit tests for a MacOS target after adding a restricted capability (keychain-access-groups). Have tried setting both manual and automatic signing (with a Mac OS development profile). The tests run on my locally fine, but when pushed to Xcode Cloud the crash report indicates a Code Signing Issue, downloading the Artifact for Test Products for AppTests and viewing the app contents I noted that when built locally embedded.provisionprofile appears within the App/Contents that doesn't appear in Xcode Cloud. To reproduce, create a new MacOS app with a test plan, run a Test job (successfully runs) then add the capability for Keychain Sharing: <array> <string>$(AppIdentifierPrefix)com.transmedics.RemoteView.group</string> </array> to the entitlements. Run the job again and tests with the project fails in Xcode Cloud, with code signing issues in the crash report.
2
0
72
1w
Accessibility IDs showing up in Accessibility Inspector, but automated testing script is unable to find them
In the app I'm working on, I have a SwiftUI View embedded in a UIKit Storyboard. The SwiftUI View holds a menu with a list of payment tools, and the ForEach loop looks like this: ForEach(self.paymentToolsVM.paymentToolsItems, id: \.self) { paymentTool in Button { navigationCallback(paymentTool.segueID) } label: { PaymentToolsRow(paymentToolName: paymentTool.title, imageName: paymentTool.imageName) .accessibilityElement() .accessibilityIdentifier("Billing_\(paymentTool.title.replacingOccurrences(of: " ", with: ""))") } if paymentTool != self.paymentToolsVM.paymentToolsItems.last { Divider() } } So you can see the accessibility ID is there, and it shows up properly when I open up Accessibility Inspector with the simulator, but the testing script isn't picking up on it, and it doesn't show up when the view is inspected in Appium. I have other SwiftUI views embedded in the UIKit view, and the script picks up the buttons on those, so I'm not sure what's different about this one. If it helps, the script is written in Java with the BDD framework. I can try to get the relevant part of the script if anyone thinks that would be helpful. Otherwise, is there anything else I can try?
1
0
105
2w
Xcode Not Displaying Code Coverage for Main App When Using Test Plan on iOS Simulator
I am encountering an issue where code coverage data is not showing for my main app in Xcode when running tests for the iOS simulator. However, code coverage is being reported correctly for some modules. Enable Code Coverage Support: YES Xcode 16.2 macOS: 15.3.1 Macbook Pro M1 14-inch, 2021 Despite these configurations, Xcode fails to show code coverage for the main app. Can anyone suggest what might be causing this issue and how to ensure code coverage is correctly reported for the main app during simulator builds?
1
0
92
May ’25
Intermittent Screen Lock During Appium Tests on iOS 18 Simulator
I am running Appium tests on an iOS 18 simulator, and I am encountering an intermittent issue where the device screen gets locked unexpectedly during the tests. The Appium logs show no errors or unusual activity, and all commands appear to be executed successfully. However, upon reviewing the device logs, I see entries related to the lock event, but the exact cause remains unclear. SpringBoard: (SpringBoard) [com.apple.SpringBoard:Common] lockUIFromSource:Boot options:{ SBUILockOptionsLockAutomaticallyKey: 1, SBUILockOptionsForceLockKey: 1, SBUILockOptionsUseScreenOffModeKey: 0 } SpringBoard: (SpringBoard) [com.apple.SpringBoard:Common] -[SBTelephonyManager inCall] 0 SpringBoard: (SpringBoard) [com.apple.SpringBoard:Common] LockUI from source: Now locking Has anyone experienced similar behavior with Appium on iOS 18, or could there be a setting or configuration in the simulator that is causing this issue?
0
0
44
Apr ’25
Xcode Test Pane for TDD and Unit Tests?
At the last place I worked it took roughly 5 minutes to do an application build. Which in turn made doing any sort of TDD or ever just regular Unit Tests extremely painful to do as the cycle time was simply too long. But that got me thinking. In recent versions of Xcode, Apple added Previews for SwiftUI Views that basically showed code changes to the View in real time. And Previews were made possible by extremely targeted compilation of the view in question. So... what if instead of a Preview pane in the Xcode IDE there was a Test pane the could be displayed such that Tests for a piece of code could be created and run almost immediately? Perhaps by adding a #Testing section to your code #Testing(MyService.self) // Define the entity to be tested. If you could drop the turnaround time AND provide a test playground for service level code that could speed development of such code greatly... and encourage interactive test development at the same time. What do you think?
0
0
34
Apr ’25
FamilyControls Entitlement Not Working for External TestFlight Testers
Hi all, I’ve run into a frustrating issue with the FamilyControls and DeviceActivityMonitor APIs. I’ve received official approval from Apple to use the com.apple.developer.family-controls entitlement (distribution), and I’ve added the entitlement to both my main app and the DeviceActivityMonitor extension. I’ve also ensured the correct App Group is configured for both targets. Everything works perfectly when I install the app on my own device as an internal TestFlight tester. App blocking works, the DeviceActivityMonitor extension runs as expected, and the apps selected by the user are correctly shielded. However, for external TestFlight testers, while they do receive the Screen Time permission prompt, and can select apps to block, nothing actually gets blocked. It appears that the DeviceActivityMonitor extension is not being triggered at all on their devices. I’ve verified the following: The entitlement is approved and visible in App Store Connect The build is approved for external testing Testers are running iOS 16+ Shielding logic works properly on internal tester devices Clean installs have been tested on external devices Has anyone gotten FamilyControls + DeviceActivityMonitor working successfully for external testers via TestFlight? If this is a known limitation or if there are any additional steps required to enable extension execution for external users, I’d really appreciate any clarification. Thanks in advance for your help.
1
0
78
May ’25
Facing "Failed to create promise" issue on ios 18 simulators
Hi, We are facing issues on ios simulators os version 18, "Simulator device failed to install the application. Failed to create promise. Underlying error (domain=IXErrorDomain, code=2):" Due to this error simulator is unable to install the application. we are facing this intermittently. xcode version : Xcode.16.0.0.16A242d.app ios simulator runtime : com.apple.CoreSimulator.SimRuntime.iOS-18-0 ios simulator : com.apple.CoreSimulator.SimDeviceType.iPhone-16 mac os version : macOS 15.4 we have tried upgrading to xcode Xcode.16.1.0.16B40.app and ios simulator runtime to 18.1 but its not working. Also we have rebooted xcode, not helping. *Exact error message : ** org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: An unknown server-side error occurred while processing the command. Original error: Error running 'install': An error was encountered processing the command (domain=IXErrorDomain, code=2): Simulator device failed to install the application. Failed to create promise. Underlying error (domain=IXErrorDomain, code=2): Failed to set icon resources promise for com.yyyy.xxxx Failed to create promise. Host info: host: 'uci-macmini-019lab3b.local', ip: 'fe80:0:0:0:1caf:6627:141d:f464%en0' Build info: version: '4.30.0', revision: '509c7f17cc' System info: os.name: 'Mac OS X', os.arch: 'aarch64', os.version: '15.3.1', java.version: '11.0.25' Driver info: com.mypackage.common.drivers.CustomIosDriver$ByteBuddy$g865VfU3 Command: [null, newSession {capabilities=[{appium:webviewConnectTimeout=120000, appium:autoAcceptAlerts=true, appium:app=/Users/mobileci/.buildkite-agent/builds/uci-macmini-019lab3b/mypackage/e2e-test-ios-simulator/8155f349-18b9-413c-9d17-dcb064986154/test_artifacts/target.app, appium:includeSafariInWebviews=true, appium:locale=US, appium:mjpegServerPort=52715, appium:newCommandTimeout=600000, appium:waitForIdleTimeout=3, appium:derivedDataPath=/Users/mobileci/.buildkite-agent/builds/uci-macmini-019lab3b/mypackage/e2e-test-ios-simulator/8155f349-18b9-413c-9d17-dcb064986154/appium_wda_ios/, appium:wdaConnectionTimeout=300000, appium:wdaLaunchTimeout=300000, appium:processArguments={env={E2E_TESTING=YES, RUN_UUID=8155f349-18b9-413c-9d17-dcb064986154}}, appium:automationName=XCUITest, appium:fullReset=true, appium:udid=F266ECC3-FD23-464D-B0C3-576EB48B2FF5, appium:deviceName=E2ESimulator, appium:wdaLocalPort=52714, appium:showXcodeLog=true, appium:webkitDebugProxyPort=52716, appium:noReset=false, appium:language=en, platformName=IOS, appium:simpleIsVisibleCheck=true}], desiredCapabilities=Capabilities {app: /Users/mobileci/.buildkite-..., autoAcceptAlerts: true, automationName: XCUITest, derivedDataPath: /Users/mobileci/.buildkite-..., deviceName: E2ESimulator, fullReset: true, includeSafariInWebviews: true, language: en, locale: US, mjpegServerPort: 52715, newCommandTimeout: 600000, noReset: false, platformName: IOS, processArguments: {env: {E2E_TESTING: YES, RUN_UUID: 8155f349-18b9-413c-9d17-dcb...}}, showXcodeLog: true, simpleIsVisibleCheck: true, udid: F266ECC3-FD23-464D-B0C3-576..., waitForIdleTimeout: 3, wdaConnectionTimeout: 300000, wdaLaunchTimeout: 300000, wdaLocalPort: 52714, webkitDebugProxyPort: 52716, webviewConnectTimeout: 120000}}] Capabilities {app: /Users/mobileci/.buildkite-..., autoAcceptAlerts: true, automationName: XCUITest, derivedDataPath: /Users/mobileci/.buildkite-..., deviceName: E2ESimulator, fullReset: true, includeSafariInWebviews: true, language: en, locale: US, mjpegServerPort: 52715, newCommandTimeout: 600000, noReset: false, platformName: IOS, processArguments: {env: {E2E_TESTING: YES, RUN_UUID: 8155f349-18b9-413c-9d17-dcb...}}, showXcodeLog: true, simpleIsVisibleCheck: true, udid: F266ECC3-FD23-464D-B0C3-576..., waitForIdleTimeout: 3, wdaConnectionTimeout: 300000, wdaLaunchTimeout: 300000, wdaLocalPort: 52714, webkitDebugProxyPort: 52716, webviewConnectTimeout: 120000} at
0
0
75
Apr ’25
TestFlight Build Stuck in "Waiting for Review" for External Testers (Post-App Store Release)
Hi everyone, I’ve been facing an issue with TestFlight external builds that I haven't encountered before, and I’d appreciate any insights. Background: I have an iOS app that was recently approved and released to the App Store. Prior to this, I’ve regularly submitted TestFlight builds (with updated version and build numbers) to both internal and external tester groups. Internal builds would appear instantly, as expected. External builds were also available almost immediately after selecting “Ready to Submit.” This was consistent for many iterations. Current Issue: After pushing the latest version to the App Store (which went through the standard review process and was approved), I prepared a new version for TestFlight testing. Here’s what happened: Uploaded a new build with a new version number and build number. It appeared instantly for internal testing as usual. When I tried adding it to the external tester group, the build got stuck in the “Waiting for Review” state. I uploaded this on Saturday night, and as of Monday noon, the status has not changed. I also cancelled that build and uploaded a fresh one with an incremented build number — still stuck in the same status. Additional Notes: The app’s ITSAppUsesNonExemptEncryption key is set to false in Info.plist. There is no missing export compliance warning on App Store Connect. The changes in the new build are minor — a few small updates, nothing significant. I tried decreasing the build number temporarily (which caused an error), then increased it again. No changes were made to permissions, app capabilities, or metadata that would typically trigger a longer review. Questions: Is this expected after an App Store release? Has anyone else experienced delays like this recently for TestFlight external builds? Is there anything I can do to expedite the review? Thanks in advance for any help!
0
0
67
Apr ’25
Unexpected behaviour of hardware keyboard focus in UITests
Hello! I was faced with unexpected behavior of hardware keyboard focus in UITests. A clear description of the problem When running UITests on the iOS Simulator with both "Full Keyboard Access" and "Connect Hardware Keyboard" options enabled, there is a noticeable delay between keyboard actions for focus managing (like pressing Tab or arrow keys). The delay seems to increase with repeated input and suggests that events are being queued instead of processed immediately. I will describe why I have such an assumption later. A step-by-step set of instructions to reproduce the problem Launch the iOS Simulator. Enable both "Full Keyboard Access" and "Connect Hardware Keyboard" in the Simulator settings. Run a UITest on a target application (ideally an endless or long-running test). Once the app is launched, press the Tab key several times. Observe the delay in focus movement. Optionally, press the Tab or arrow keys rapidly, then stop the UITest. After stopping, you’ll see a burst of rapid focus changes. What results you expected We expected keyboard actions (like Tab) to be handled immediately and the UI focus to update smoothly during UITests. What results you saw There was a 4–10 (end more) second delay between pressing keys and seeing a response. All stacked keyboard events (used for managing focus) are performed all at once after stopping the UITest. The version of Xcode you are using Xcode: Version 16.3 (16E140) Simulator: iPhone 16 Pro (iOS 18.4 and 18.1) Simulator: iPad Pro 11-inch (M4) (iPadOS 17.5)
1
2
106
Apr ’25
TestFlight group selection disabled for 'Ready to Test' build — Tried 3 builds, same issue
Hello, I uploaded a new iOS build (1.0.1 - Build 180) to App Store Connect for my app "Benimle Konus". The build has been processed successfully and is marked as "Ready to Test". However, when I try to assign this build to any internal TestFlight group, the group checkboxes are greyed out and cannot be selected. I’ve made sure that: All required metadata is filled out. What’s New and compliance information is complete. Previous builds worked with the same TestFlight groups. To fix this, I have uploaded 3 separate builds, but the issue still persists with all of them. There are no error messages, but I can't continue testing because I can't assign the build to testers. App ID: 6742759002 Bundle ID: com.benimlekonus.app Build Version: 1.0.1 (180) Is this a known issue or something I'm missing? Any help would be appreciated.
16
13
908
Mar ’25