macOS test case - Could not launch app

Hi,

Overview

I am using Xcode Cloud for my multi platform app.

The macOS test case fails, however the iOS test case runs and succeeds.

I don't have any UI test cases written, the test case are simple and have nothing platform (macOS) specific.

Questions

  1. What can I do to fix this?
  2. Is there any user privileges needed to launch the macOS app for testing? I ask because when I ran the UI tests locally it launched the app and asked for my macOS user password. Just wondering if that is the reason it didn't launch in Xcode Cloud.

Error:

<Appname> encountered an error (Failed to install or launch the test runner. If you believe this error represents a bug, please attach the result bundle at /Volumes/workspace/resultbundle.xcresult.(Underlying Error: Could not launch "AppnameTests. The LaunchServices launcher has returned an error. Please check the system logs for
the underlying cause of the error. (Underlying Error: The operation couldn't be completed. Launch failed. (Underlying Error: Launch job spawn failed) )))
× Could not launch "<Appname>"
× Could not launch "AppnameTests"
× AppnameUITests.testExample()
Failed to get launch progress for <XCUIApplicationImpl: 0x600000564630 <BundleID> at /Volumes/workspace/TestProducts/Debug-Dev/<Appname>.app>: Could not launch "app name". The LaunchServices launcher has returned an error. Please check the system logs for the underlying cause of the error. (Underlying Error: The operation couldn't be completed. Launch failed. (Underlying Error: Launch job spawn failed))
AppnameUITests.swift:28
* AppnameUITests.testLaunchPerformance)
Failed to get launch progress for «XCUIApplicationimpl: 0x60000054630 <BundleID> at /Volumes/workspace/TestProducts/Debug-Dev/<Appname>.apps: Could not launch "<Appname>". The LaunchServices launcher has returned an error. Please check the system logs for the underlying cause of the error. (Underlying Error: The operation couldn't be completed. Launch failed. (Underlying Error: Launch job spawn failed))
AppnameUITests.swift:37 g
* AppnameUITestsLaunchTests.testLaunch)
Failed to get launch progress for «XCUIApplicationimpl: 0x60000054630 <BundleID> at /Volumes/workspace/Testroducts/Debug-Dev/<Appname>.apps: Could not launch "<Appname>". The LaunchServices launcher has returned an error. Please check the system logs for the underlying cause of the error. (Underlying Error: The operation couldn't be completed. Launch failed.

Does your app successfully compile and run on both platforms? It seems as though LaunchServices was unable to start the macOS version of your application.

There are no user privileges needed to launch the macOS app for testing, beyond the password entry requirement during a local test. Xcode Cloud does not have this requirement.

@Developer Tools Engineer

Yes the app successfully compiles and runs on both platforms.

Questions:

  1. What is the password entry requirement during local test?
  2. Based on the error message /Volumes/workspace/resultbundle.xcresult on Xcode Cloud? I couldn't find it, there is very little I can do.
  3. If I provide app name would it be possible for you to investigate?
  4. Is there any way to resolve / understand the issue?

Note: I remember when I first pressed Command U (Product > Test), the app did ask for some authentication and I had press the Touch ID / enter macOS user password for it to run. The app doesn't do any authentication on it is own.

Scheme:

  • I had deleted a target and added a target so I ended up adding my scheme and I had to add the Tests (UI and non-UI) in the scheme.

Please help the following is the password that XCTest was requesting on my Mac:

This is required for the Mac, for iOS it runs without asking for password, So I am wondering if this is the reason why XCTest for the Mac doesn't run on Xcode Cloud.

I found this post regarding the same https://developer.apple.com/forums/thread/693850

Question:

I am not sure how to run automationmodetool disable-automationmode-without-authentication on Xcode Cloud?

I have a project that shows the same error when running tests on macOS. I isolated the problem in a sample project yesterday and attached it to my feedback (FB11992869). The commit that broke it added the Keychain Sharing entitlement, which, unfortunately, is required for some of the tests.

macOS test case - Could not launch app
 
 
Q