Create and run unit tests, performance tests, and UI tests for your Xcode project using XCTest.

XCTest Documentation

Posts under XCTest tag

154 Posts
Sort by:
Post not yet marked as solved
0 Replies
304 Views
Hi, I'm in the team maintaining company-wise CI for iOS build and test, which runs over 100 macs on the system with every stable versions of Xcode/simulators and the latest beta/rc. I've been terribly suffered from xcodebuild test failure with simulator destination on Xcode beta series since Xcode 14.x has changed its CoreSimulator behavior from static simruntime into simdisk-based dynamic runtime. (If you search for xcrun simctl runtime match set 'watchos9.1' 20S75 you can check what I have been fighting for.) At the end of numerous nightly overtimes I finally found out that ~/Library/Developer/CoreSimulator/RuntimeMap.plist is closely related to xcrun simctl runtime match command. If CoreSimulatorService relaunches when RuntimeMap.plist is corrupted (or missing), Chosen Runtime will be set as default SDK (pretty sure it is SDK version of iphoneos, not iphonesimulator) ex) $ sudo xcode-select -s /Applications/Xcode_15.2.app $ sed -i '' -e 's|21C62|21Cblabla|' ~/Library/Developer/CoreSimulator/RuntimeMap.plist $ sudo pkill -9 com.apple.CoreSimulator.CoreSimulatorService $ xcrun simctl runtime match list == Evaluation Results == appletvos17.2: SDK Version: 17.2 SDK Build: 21K354 Platform: com.apple.platform.appletvos Chosen Runtime: tvOS 17.2 (17.2 - 21K364) - com.apple.CoreSimulator.SimRuntime.tvOS-17-2 User Override: (null) Preferred: tvOS 17.2 (17.2 - 21K364) - com.apple.CoreSimulator.SimRuntime.tvOS-17-2 Default: 21K354 iphoneos17.2: SDK Version: 17.2 SDK Build: 21C52 Platform: com.apple.platform.iphoneos Chosen Runtime: 21C52 User Override: (null) Preferred: 21Cblabla Default: 21C52 watchos10.2: SDK Version: 10.2 SDK Build: 21S355 Platform: com.apple.platform.watchos Chosen Runtime: watchOS 10.2 (10.2 - 21S364) - com.apple.CoreSimulator.SimRuntime.watchOS-10-2 User Override: (null) Preferred: watchOS 10.2 (10.2 - 21S364) - com.apple.CoreSimulator.SimRuntime.watchOS-10-2 Default: 21S355 xros1.0: SDK Version: 1.0 SDK Build: 21N301 Platform: com.apple.platform.xros Chosen Runtime: visionOS 1.0 (1.0 - 21N305) - com.apple.CoreSimulator.SimRuntime.xrOS-1-0 User Override: (null) Preferred: visionOS 1.0 (1.0 - 21N305) - com.apple.CoreSimulator.SimRuntime.xrOS-1-0 Default: 21N301 The question is: Where exactly is the path or file that reflects this change? What file is Chosen Runtime of runtime match list tracking? When is the time to re-download and fix if it is corroded or not found? P.S. Thanks valexeev4 for letting me know where RuntimeMap plist is. https://developer.apple.com/forums/thread/738077?answerId=765617022#765617022
Posted
by dokimyj.
Last updated
.
Post not yet marked as solved
3 Replies
920 Views
I'm trying to write performance tests with Xcode 15, but it's not working: even though setting a baseline seems to work (baseline data files are created), Xcode seems to ignore that baseline altogether whenever the test is run. As a result, performance tests never fail, no matter how bad performance gets. The source editor persistently displays a “No baseline average for Time” message. Has anyone else encountered this? Figured out how to sidestep the issue? Of note, the issue is easily reproduced: create a new (macOS in my case) app project with tests, add a dummy performance test; run the test once and save its baseline, and despite this subsequent tests will always succeed, even if you significantly slow the dummy test down. (I've filed this as FB13330139)
Posted
by Cykelero.
Last updated
.
Post not yet marked as solved
1 Replies
428 Views
Hello! Since Xcode 15 came out, I've been having this issue with UI tests where the test runner hangs for 60s when the keyboard is presented. In the test logs I get this kind of messages: 00:07.588 Wait for com.example.app to idle 01:07.642 App event loop idle notification not received, will attempt to continue. Interestingly, this only appears to be happening in CI environments (I've tried Xcode cloud and Circle CI). It works fine on my local machine. Everything is fine with Xcode 14, but I can't keep my CI environment stuck on Xcode 14 forever. I've tried disabling animations using UIView.setAnimationsEnabled(false), but it did not fix the problem. Here are the full logs of what it takes to fill out a text field: logs.txt
Posted Last updated
.
Post not yet marked as solved
8 Replies
1.9k Views
For my test automation project I use addUIInterruptionMonitor to keep the tests running smoothly. On iOS 17 this function seems to never get triggered. This code snippet contains a test that passes on iOS 15 and 16, but not on iOS 17 (tested on iPhone 12, iOS 15.5, iPhone 13 Mini, iOS 16.4.1 and iPhone 14 Pro, iOS 17.0). To run the test, disable wifi and cell data on the test device first. import XCTest class Interruptions: XCTestCase { func testCatchInterruption() { // Run test on device with wifi and cell data disabled var caughtInterruption = false addUIInterruptionMonitor(withDescription: "Generic Alert Handler") { element -> Bool in element.buttons["OK"].tap() caughtInterruption = true return true } let safariApp = XCUIApplication(bundleIdentifier: "com.apple.mobilesafari") safariApp.launch() // Expect to see pop-up saying "Cellular Data is turned off" safariApp.tap() sleep(5) // Pop-up should be gone XCTAssert(caughtInterruption) } }
Posted Last updated
.
Post not yet marked as solved
1 Replies
347 Views
I'm trying to write a unit test for a SwiftData migration. In the teardown function I delete the SQLite container files, but then the underlying sqlite library complains. There must be a way to gracefully terminate the SwiftData container before I delete the files, but I don't see how. Simplying nil-ifying the references doesn't work. I don't see any obvious close functions, so I hope someone knows a non-obvious function. override func tearDownWithError() throws { // Cleanup resources // -- DOES NOT CLOSE UNDERLYING SQLITE ACCESS -- self.container = nil self.context = nil // Delete database do { try FileManager.default.removeItem(at: self.url) } catch { // Ignore file not found, report everything else. let nserror = error as NSError if nserror.domain != "NSCocoaErrorDomain" && nserror.code == 4 { throw error } } try? FileManager.default.removeItem(at: self.url.deletingPathExtension().appendingPathExtension("store-shm")) try? FileManager.default.removeItem(at: self.url.deletingPathExtension().appendingPathExtension("store-wal")) } I get these errors for .store, store-shm, and .store-wal: BUG IN CLIENT OF libsqlite3.dylib: database integrity compromised by API violation: vnode unlinked while in use: /Users/(ME)/Library/Developer/XCTestDevices/C52F4E12-EB4F-4639-9866-C3A7126155FA/data/Containers/Data/Application/B0EE90C6-B95D-4185-890D-6F20766B9B3B/tmp/test1.store invalidated open fd: 11 (0x11) If the worst comes to the worst, I'll work around it by using a differently-named container for each test, but as they're in tmp they'll get cleaned up for me eventually.
Posted Last updated
.
Post not yet marked as solved
0 Replies
348 Views
I am running xctests from command line on XCode 15.2 on iOS 17.2 simulators. As per WWDC2021 video on Memory issues, I am passing `-enablePerformanceTestsDiagnostics Yes' in following xcodebuild command. xcodebuild test -project project_name.xcodeproj -scheme test-scheme -destination 'platform=iOS Simulator,name=iPhone 15 Pro' -enablePerformanceTestsDiagnostics YES Final logs before test results: Tests-Runner(16873) MallocStackLogging: stack logs deleted from /private/tmp/stack-logs.16873.10148c000.Tests-Runner.M6gFw .xcresults is generated but no memgraph file is attached along with it.
Posted
by rcrahul4.
Last updated
.
Post not yet marked as solved
0 Replies
398 Views
Hi there, I'm trying to figure out an issue I'm seeing where the xcresult bundle isn't including the crash report after building and running with xcodebuild. I have a simple test app that has a single button that intentionally crashes and an XCUI test to run it. The UI Test also passes which can probably be explained by the lack of any asserts after clicking the button, but I assumed the app crashing would fail the test. The app itself is a Mac OS app with a single button called "Crash" that links to a method: - (IBAction)crash:(id)sender { @throw NSInternalInconsistencyException; } and a test method: XCUIApplication *app = [[XCUIApplication alloc] init]; [app launch]; XCUIElement *crashButton = [[XCUIApplication alloc] init].windows[@"Window"].buttons[@"Crash"]; XCTAssert([crashButton exists]); [crashButton click]; There is an ips file corresponding to the crash in ~/Library/Logs/DiagnosticReports so the crash gets written, but the test passes. After using xcresulttool to dump the Diagnostics folder from the xcresult bundle, I see these lines in the session log: 10:59:20.790 xcodebuild[23184:6634391] Handling Crash: MacAppTest (23189) main. libsystem_c.dylib: abort() called 10:59:20.792 MacAppTestUITests-Runner[23188:6635181] Process crashed with pid:23189 path:/Users/USER/Library/Developer/Xcode/DerivedData/MacAppTest-dxrjhasbuvyffhenipmdemzdpdht/Build/Products/Debug/MacAppTest.app/Contents/MacOS/MacAppTest bundleID:com.company.MacAppTest summary:main 10:59:20.792 MacAppTestUITests-Runner[23188:6635181] Ignoring crash for com.company.MacAppTest:23189 because we are not currently tracking it 10:59:21.371 MacAppTestUITests-Runner[23188:6634605] Returning result XCTWaiterResultCompleted for waiter <XCTWaiter: 0x6000025fd4d0> 10:59:21.371 MacAppTestUITests-Runner[23188:6634605] Wait <XCTWaiterWait: 0x600003e1b540> completed after 1.003s 10:59:21.371 MacAppTestUITests-Runner[23188:6634605] cleaning up delay The Ignoring crash for com.company.MacAppTest:23189 because we are not currently tracking it is what I suspect is the issue. How can I get the UITest to track the app so that when it crashes, the test fails? Some other lines from the logarchive file that may be helpful: 2024-02-14 10:59:20.612346 -0800 osanalyticshelper xpc log creation type 309 result success: /Users/<REDACTED>/Library/Logs/DiagnosticReports/MacAppTest-2024-02-14-105920.ips 2024-02-14 10:59:20.613030 -0800 testmanagerd Calling new file handler <__NSMallocBlock__: 0x6000031761f0> for MacAppTest-2024-02-14-105920.ips 2024-02-14 10:59:20.614240 -0800 ReportCrash client log create type 309 result success: /Users/<REDACTED>/Library/Logs/DiagnosticReports/MacAppTest-2024-02-14-105920.ips 2024-02-14 10:59:20.615417 -0800 testmanagerd Read crash report from /Users/<REDACTED>/Library/Logs/DiagnosticReports/MacAppTest-2024-02-14-105920.ips, got 17327 bytes of data Thanks!
Posted
by fushi.
Last updated
.
Post not yet marked as solved
0 Replies
309 Views
I'm trying some sample with xcodebuild test command for i(Pad)OS simulators, figuring out some strange behavior on simulator initiation. 00:00:38 -------------------------- 00:00:38 --- Step: xcode_select --- 00:00:38 -------------------------- 00:00:38 Setting Xcode version to /Applications/Xcode/Xcode_15.3_beta_3.app for all build steps 00:00:38 Init simulators ... 00:00:39 $DEVELOPER_DIR 00:00:39 /Applications/Xcode/Xcode_15.3_beta_3.app/Contents/Developer ... 00:05:26 ▸ 2024-02-14 15:13:41.319 xcodebuild[12903:1082819] [MT] IDELaunchReport: 4a4f919bfba30580:4a4f919bfba30580: Finished with error: Simulator device failed to install the application. 00:05:26 ▸ Domain: IXErrorDomain 00:05:26 ▸ Code: 2 00:05:26 ▸ Failure Reason: Failed to locate promise. 00:05:26 ▸ User Info: { 00:05:26 ▸ FunctionName = "+[IXPlaceholder _placeholderForBundle:client:withParent:installType:metadata:placeholderType:mayBeDeltaPackage:error:]"; 00:05:26 ▸ IDERunOperationFailingWorker = IDELaunchiPhoneSimulatorLauncher; 00:05:26 ▸ SimCallingSelector = "installApplication:withOptions:error:"; 00:05:26 ▸ SourceFileLine = 803; 00:05:26 ▸ } 00:05:26 ▸ -- 00:05:26 ▸ Failed to set icon promise for com.example.myapp 00:05:26 ▸ Domain: IXErrorDomain 00:05:26 ▸ Code: 2 00:05:26 ▸ Failure Reason: Failed to create promise. 00:05:26 ▸ User Info: { 00:05:26 ▸ FunctionName = "+[IXPlaceholder _placeholderForBundle:client:withParent:installType:metadata:placeholderType:mayBeDeltaPackage:error:]"; 00:05:26 ▸ SourceFileLine = 803; 00:05:26 ▸ } 00:05:26 ▸ -- 00:05:26 ▸ Placeholder did not exist for UUID 2810E06A-4565-4966-BE98-AE4A6A96D916 when called for -[IXSClientConnection _remote_IXSPlaceholder:setIconPromiseUUID:completion:] by client CoreSimulatorBridge (pid 13037) 00:05:26 ▸ Domain: IXErrorDomain 00:05:26 ▸ Code: 3 00:05:26 ▸ Failure Reason: Failed to locate promise. 00:05:26 ▸ User Info: { 00:05:26 ▸ FunctionName = "-[IXSClientConnection _fetchPlaceholderForUUID:method:andRunWithPromise:error:]"; 00:05:26 ▸ SourceFileLine = 1945; 00:05:26 ▸ } 00:05:26 ▸ -- 00:05:26 ▸ 2024-02-14 15:13:41.323 xcodebuild[12903:1082819] [MT] IDELaunchReport: 4a4f919bfba30580:4a4f919bfba30580: com.apple.dt.IDERunOperationWorkerFinished { 00:05:26 ▸ "device_model" = "iPhone14,7"; 00:05:26 ▸ "device_osBuild" = "16.4 (20E247)"; 00:05:26 ▸ "device_platform" = "com.apple.platform.iphonesimulator"; 00:05:26 ▸ "dvt_coredevice_version" = "355.23"; 00:05:26 ▸ "dvt_mobiledevice_version" = "1643.100.52"; 00:05:26 ▸ "launchSession_schemeCommand" = Test; 00:05:26 ▸ "launchSession_state" = 1; 00:05:26 ▸ "launchSession_targetArch" = arm64; 00:05:26 ▸ "operation_duration_ms" = 108400; 00:05:26 ▸ "operation_errorCode" = 2; 00:05:26 ▸ "operation_errorDomain" = IXErrorDomain; 00:05:26 ▸ "operation_errorWorker" = IDELaunchiPhoneSimulatorLauncher; 00:05:26 ▸ "operation_name" = IDERunOperationWorkerGroup; 00:05:26 ▸ "param_debugger_attachToExtensions" = 0; 00:05:26 ▸ "param_debugger_attachToXPC" = 0; 00:05:26 ▸ "param_debugger_type" = 1; 00:05:26 ▸ "param_destination_isProxy" = 0; 00:05:26 ▸ "param_destination_platform" = "com.apple.platform.iphonesimulator"; 00:05:26 ▸ "param_diag_MainThreadChecker_stopOnIssue" = 0; 00:05:26 ▸ "param_diag_MallocStackLogging_enableDuringAttach" = 0; 00:05:26 ▸ "param_diag_MallocStackLogging_enableForXPC" = 0; 00:05:26 ▸ "param_diag_allowLocationSimulation" = 1; 00:05:26 ▸ "param_diag_checker_tpc_enable" = 0; 00:05:26 ▸ "param_diag_gpu_frameCapture_enable" = 3; 00:05:26 ▸ "param_diag_gpu_shaderValidation_enable" = 0; 00:05:26 ▸ "param_diag_gpu_validation_enable" = 1; 00:05:26 ▸ "param_diag_memoryGraphOnResourceException" = 0; 00:05:26 ▸ "param_diag_queueDebugging_enable" = 1; 00:05:26 ▸ "param_diag_runtimeProfile_generate" = 1; 00:05:26 ▸ "param_diag_sanitizer_asan_enable" = 0; 00:05:26 ▸ "param_diag_sanitizer_tsan_enable" = 0; 00:05:26 ▸ "param_diag_sanitizer_tsan_stopOnIssue" = 0; 00:05:26 ▸ "param_diag_sanitizer_ubsan_stopOnIssue" = 0; 00:05:26 ▸ "param_diag_showNonLocalizedStrings" = 0; 00:05:26 ▸ "param_diag_viewDebugging_enabled" = 0; 00:05:26 ▸ "param_diag_viewDebugging_insertDylibOnLaunch" = 0; 00:05:26 ▸ "param_install_style" = 2; 00:05:26 ▸ "param_launcher_UID" = 2; 00:05:26 ▸ "param_launcher_allowDeviceSensorReplayData" = 0; 00:05:26 ▸ "param_launcher_kind" = 0; 00:05:26 ▸ "param_launcher_style" = 0; 00:05:26 ▸ "param_launcher_substyle" = 0; 00:05:26 ▸ "param_runnable_appExtensionHostRunMode" = 0; 00:05:26 ▸ "param_runnable_productType" = "com.apple.product-type.application"; 00:05:26 ▸ "param_structuredConsoleMode" = 0; 00:05:26 ▸ "param_testing_launchedForTesting" = 1; 00:05:26 ▸ "param_testing_suppressSimulatorApp" = 1; 00:05:26 ▸ "param_testing_usingCLI" = 0; 00:05:26 ▸ "sdk_canonicalName" = "iphonesimulator17.4"; 00:05:26 ▸ "sdk_osVersion" = "17.4"; 00:05:26 ▸ "sdk_variant" = iphonesimulator; 00:05:26 ▸ } When I choose iPad 10th Generation, iPhone 14, 14 plus, 14 pro or 14 pro max devices listed on xcrun simctl list it fails with the log above. (doesn't matter what OS version is selected) Other than those sims it works (I checked it on iPhone SE 3rd gen, ipad mini 6g) Are those devices excluded from Xcode 15.3 Beta 3? Then why are those on the xcrun simctl list still? FYI: myapp took -Wl and -ld_classic for OTHER_LDFLAGS option in xcconfig after first app installation crash, still didn't make any changes.
Posted
by dokimyj.
Last updated
.
Post not yet marked as solved
1 Replies
591 Views
Hello, I'm having an issue with Unit testing on xCode 15.2 and macOS Sonoma. I'm trying to run unit testing and it hangs for a long time and then fails, previously I was able to run my unit testing on simulator with iOS 14, however after upgrading the xCode and the macOS I'm unable to use simulators with iOS 14 and my unit testing keeps failing. I have another device which is running macOS Ventura and I can run my unit testing on it without any problems using simulators with iOS 14 on xCode 15.0. Please note the issue is not with the xCode version because I tried downgrading and still have the same issue. I tried every solution i can find on this forum and others, I couldn't find anything that would help. I can't attach the dump log file directly since it's big so please use the link below https://drive.google.com/file/d/1v_gpCLhEuUdqFF6aCfrGislYWV8ZE8Qm/view?usp=share_link
Posted
by Yasser95.
Last updated
.
Post not yet marked as solved
0 Replies
289 Views
Hi. I am measuring performances of methods in unit test on Xcode. Measuring performances on release build is important since you can know if a performance issue will be solved by compiler or not. However, when you specify its build as release, you cannot use @testable. Please tell me any manners. Thanks.
Posted
by y_ich.
Last updated
.
Post not yet marked as solved
0 Replies
282 Views
Xcode is not not picking up when I make changes to my unit test files when running tests. The only way is to clean the whole project and rebuild again. Any ideas why? I recently tried Xcode cloud and this behaviour started after removing that option
Posted Last updated
.
Post not yet marked as solved
0 Replies
303 Views
Since I start to wrote UITest, this keep happened with no waring, following image is the log, sensitive info has been replaced. However, once I run app, then run test again, UITest just work out, it seems like a wired but, and the method just a working around bug to me,
Posted
by Rimbaud.
Last updated
.
Post not yet marked as solved
1 Replies
359 Views
I am writing a SPM based project for MacOS. In this project? I need to access MacOS Keychain. I am write a swift test built by SPM testTarget(). I can see it generates a bundle ./.build/x86_64-apple-macosx/debug/MyProjectTests.xctest with an executable: % file ./.build/x86_64-apple-macosx/debug/MyProjectPackageTests.xctest/Contents/MacOS/MyProjectPackageTests ./.build/x86_64-apple-macosx/debug/MyProjectPackageTests.xctest/Contents/MacOS/MyProjectPackageTests: Mach-O 64-bit bundle x86_64 This bundle file cannot be executed. How can I execute its tests? I tried with xcodebuild test-without-building -xctestrun ./.build/x86_64-apple-macosx/debug/MyProjectPackageTests.xctest -destination 'platform=macOS' without any chance. Obviously the next question is can I 'simply' add entitlement to this bundle with codesign to fix my enttilement error. My error when running the test is A required entitlement isn't present.
Posted Last updated
.
Post not yet marked as solved
9 Replies
4.9k Views
We got the newly issue that our Test devices keeps us asking for the pin code to "Enable UI Automation". Then it works for some hours or days, but after some time it starts again. "Enable UI Automation" is already enabled in "Settings" - "Developer" menu. The devices are located remotely and we can't access them directly, so this is a big issue for us right now. Is there any way to avoid this?
Posted Last updated
.
Post not yet marked as solved
9 Replies
2.8k Views
I'm new to Xcode cloud - working with a Mac OS app, build is working great. Now I am trying to add a Test action; the testing target builds but won't run, and the error indicates it can't find the testing bundle in the expected build output. There's also mention of a code signing error, but I have automatic code signing enabled with the same settings on test target as the app. I am only running the unit test (XCTest) scheme, not the UI tests. When I run it locally from the IDE it works fine, either selecting the test scheme explicitly or as the test step of the app scheme. I notice the XCTest target's scheme setup uses Debug builds and expects the test output to be in the Debug .app bundle, I thought perhaps that was the problem (in case only the release app bundle actually gets built in the Xcode Cloud environment). So I created a duplicate scheme and set the build targets to Release - again I can run this fine locally (after creating a release build), but it fails with the same error in Xcode cloud. I also tried changing the code signing certificate from "Development" to "Sign to run locally" to see if that made a difference, but I get the same error. (It's using my developer account Team, and "Automatically manage signing".) Can anyone relate the proper way to set up an XCTest scheme so that the tests will actually run in a Mac OS Xcode Cloud workflow? I'm using Xcode 14.0.1. Here's the full error output, with [AppName] and [TestTargetName] substituted for the actual: [AppName] (....) encountered an error (Failed to load the test bundle. If you believe this error represents a bug, please attach the result bundle at /Volumes/workspace/resultbundle.xcresult. (Underlying Error: The bundle “[TestTargetName]” couldn’t be loaded. The bundle couldn’t be loaded. Try reinstalling the bundle. dlopen(/Volumes/workspace/TestProducts/Debug/[AppName].app/Contents/PlugIns/[TestTargetName].xctest/Contents/MacOS/[TestTargetName], 0x0109): tried: '/Volumes/workspace/TestProducts/Debug/[TestTargetName]' (no such file), '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/lib/[TestTargetName]' (no such file), '/Volumes/workspace/TestProducts/Debug/[AppName].app/Contents/PlugIns/[TestTargetName].xctest/Contents/MacOS/[TestTargetName]' (code signature in <....> '/Volumes/workspace/TestProducts/Debug/[AppName].app/Contents/PlugIns/[TestTargetName].xctest/Contents/MacOS/[TestTargetName]' not valid for use in process: mapped file has no Team ID and is not a platform binary (signed with custom identity or adhoc?)))) Thanks!
Posted
by ccorbell.
Last updated
.
Post not yet marked as solved
0 Replies
384 Views
In my iOS project, there is an infrequent crash related to virtual memory problem. Therefore, I plan to use UITest in combination with Product/Perform Action/Profile "TestCaseName" to conduct Game Performance-type testing. This allows the automatic testing to continuously operate until the profile stops recording upon a crash. This enables me to observe the various states of the program at the time of the crash. However, I have found that the UITest using Profile is highly unstable. The UITestCase often terminates unexpectedly during execution, leading to failed tests (Instruments is still working). Sometimes, the app is terminated immediately after startup. It seems that the use of sleep() in the code can easily cause interruption issues, which do not occur during normal UI testing. I am wondering if anyone has experience using Profile for UITest and whether they have encountered the issues I described." Working Environment: XCode14.3.1, iPhone Device iOS17.2
Posted Last updated
.
Post not yet marked as solved
1 Replies
465 Views
I am directed from https://discuss.appium.io/t/create-multiple-instances-of-the-same-app/41266/14?u=lxnm, the context is that Appium max2 driver is implementing the activating of MacOS app using XCTest API methods. There are 2 ways to implement the activating of the app, using app path (calling initWithURL) and bundle id (calling initWithBundleIdentifier). This pull request shows how the XCTest methods are called when using the Mac2 driver, specifically in the file WebDriverAgentMac/WebDriverAgentLib/Routing/FBSession.m. The problem is that I am able to launch my MacOS app(it is a company app) using bundle id, but when I launch the app with app path, I receive XcodeBuild errors: [WebDriverAgentMac] [xcodebuild] XCTExpectFailure: matcher accepted Assertion Failure: Failed to launch com.company.companyApp: You do not have permission to run the application “companyApp”. You don’t have permission. To view or change permissions, select the item in the Finder and choose File > Get Info. (Underlying Error: The operation couldn’t be completed. Operation not permitted) I followed this to enable R+W permissions to all users, but the same error is displayed.
Posted
by johnnylim.
Last updated
.
Post not yet marked as solved
1 Replies
413 Views
I am currently working on a SwiftUI project and I am trying to write a UI test for a DatePicker. However, I am having trouble interacting with the DatePicker in the test. Here is the code for the DatePicker in my SwiftUI view: DatePicker("Date", selection: $date, displayedComponents: [.date]) .datePickerStyle(.graphical) .labelsHidden() .frame(width: 150) And here is the code for my UI test: func testSelectingDateChangesMainView() throws { let app = XCUIApplication() app.launch() let dateDatePicker: XCUIElement = app.windows["mainUI-AppWindow-1"].datePickers["Date"] dateDatePicker.click() let col = dateDatePicker.descendants(matching: .any) print("\(dateDatePicker.debugDescription), \(col.debugDescription)") } When I run the test, it seems like the DatePicker does not have any descendants, so I am unable to select a date. Does anyone have any suggestions on how I can interact with a .graphical style DatePicker in a UI test? Any help would be greatly appreciated. Thank you, OnlyForF1
Posted
by OnlyForF1.
Last updated
.