I have added a brand new unit test target to my macOS app project in Xcode. It contains the default two files:
However when I run my test suite, this brand new target breaks with the error "Test operation failure: Launch session expired before checking in."
The full log is:
12:12:49.492 Xcode[10034:721978] Beginning test session MyTargetTests-3902F95F-20F9-4E6C-94EE-0BF8660D3B5A at 2017-06-18 12:12:49.492 with Xcode 8E3004b on target <DVTLocalComputer: 0x7fcc3cf024d0 (My Mac | x86_64)> (10.12.4 (16E195))
12:12:49.492 Xcode[10034:721978] Launching with Xcode.DebuggerFoundation.Launcher.LLDB
12:12:49.492 Xcode[10034:894962] Waiting for connection to unix domain socket at /tmp/XCTest-QcErkZ.
12:12:59.747 Xcode[10034:721978] Launch session started.
12:12:59.832 Xcode[10034:721978] Adding console adaptor <IDEConsoleAdaptor: 0x7fcc2cd44d00 'target'> for test session 3902F95F-20F9-4E6C-94EE-0BF8660D3B5A.
12:12:59.914 Xcode[10034:721978] Test process runnable PID is 19198.
12:13:02.025 Xcode[10034:721978] Test operation failure: Launch session expired before checking in.
12:13:02.025 Xcode[10034:721978] _finishWithError:Error Domain=IDETestOperationsObserverErrorDomain Code=5 "Launch session expired before checking in." UserInfo={NSLocalizedDescription=Launch session expired before checking in.} didCancel: 1
My setup is:
I have tried:
sudo /usr/sbin/DevToolsSecurity --enable
- no goodSo... How do I make the unit test target work?
The error message "launch session expired before checking in" is a bit of a red herring. You need to expose the real underlying error message, which you can access via View -> Debug Area -> Show Debug Area (if it is not already showing).
In my case, the problem was that libswiftswiftononesupport.dylib was not being linked to certain libraries of my own in my macOS app (dyld image not found). The solution was a bit weird, and laborious, but it does work:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With