Unit tests fails to run on Xcode 16, but works fine on Xcode 15.4 and older Xcodes

Dear Apple & Community,

I am encountering an issue while running my Unit tests on Xcode 16.
I'm receiving the following error in the debugger area.

Error loading /var/containers/Bundle/Application/FF057050-1BCC-49D8-9D3F-A3731E30F354/<Project_name>.app/PlugIns/<Project_name>.xctest/<Project_name>Tests (133): dlopen(/var/containers/Bundle/Application/FF057050-1BCC-49D8-9D3F-A3731E30F354/<Project_name>.app/PlugIns/<Project_name>.xctest/<Project_name>Tests, 0x0109): Symbol not found: _$s5Model11AccountDataV7TestingE4mockACvau Referenced from: <4027FFAF-5C6C-3F8A-9862-648D3D4A1257> /private/var/containers/Bundle/Application/FF057050-1BCC-49D8-9D3F-A3731E30F354/<Project_name>.app/PlugIns/<Project_name>.xctest/<Project_name>Tests Expected in: <406DF294-634D-3D8A-8E59-BEE455BA96AF> /System/Developer/Library/Frameworks/Testing.framework/Testing

Failed to load test bundle from file:///private/var/containers/Bundle/Application/FF057050-1BCC-49D8-9D3F-A3731E30F354/<Project_name>.app/PlugIns/<Project_name>.xctest/: Error Domain=NSCocoaErrorDomain Code=3588

.....

Error loading /var/containers/Bundle/Application/FF057050-1BCC-49D8-9D3F-A3731E30F354/<Project_name>.app/PlugIns/<Project_name>.xctest/<Project_name>Tests (133): dlopen(/var/containers/Bundle/Application/FF057050-1BCC-49D8-9D3F-A3731E30F354/<Project_name>.app/PlugIns/<Project_name>.xctest/<Project_name>Tests, 0x0109): Symbol not found: _$s5Model11AccountDataV7TestingE4mockACvau Referenced from: <4027FFAF-5C6C-3F8A-9862-648D3D4A1257> /private/var/containers/Bundle/Application/FF057050-1BCC-49D8-9D3F-A3731E30F354/<Project_name>.app/PlugIns/<Project_name>.xctest/<Project_name>Tests Expected in: <406DF294-634D-3D8A-8E59-BEE455BA96AF> /System/Developer/Library/Frameworks/Testing.framework/Testing
Failed to load test bundle from file:///private/var/containers/Bundle/Application/FF057050-1BCC-49D8-9D3F-A3731E30F354/<Project_name>.app/PlugIns/<Project_name>.xctest/: Error Domain=NSCocoaErrorDomain Code=3588

Error 3588 is NSExecutableLinkError, which gels with the other error text you’re seeing.

Let’s unpack that error:

Error loading …/<Project_name>.app/PlugIns/<Project_name>.xctest/<Project_name>Tests (133):
dlopen(…/<Project_name>.app/PlugIns/<Project_name>.xctest/<Project_name>Tests, 0x0109):
Symbol not found: _$s5Model11AccountDataV7TestingE4mockACvau
Referenced from: <4027FFAF-5C6C-3F8A-9862-648D3D4A1257> …/<Project_name>.app/PlugIns/<Project_name>.xctest/<Project_name>Tests
Expected in: <406DF294-634D-3D8A-8E59-BEE455BA96AF> /System/Developer/Library/Frameworks/Testing.framework/Testing

Line by line:

  1. Indicates that it failed to load your test bundle.

  2. Indicates that dlopen failed.

  3. Shows that the problematic symbol is _$s5Model11AccountDataV7TestingE4mockACvau. We’ll come back to that.

  4. Shows that it was imported by your test bundle.

  5. Shows that it’s expected to exported by Testing framework.

Line 3 is interesting. Let’s demangle that symbol:

% swift demangle '_$s5Model11AccountDataV7TestingE4mockACvau'
_$s5Model11AccountDataV7TestingE4mockACvau ---> (extension in Testing):Model.AccountData.mock.unsafeMutableAddressor : Model.AccountData

That’s one of your symbols, right?

The weird part is that the the dynamic linking is looking for it in the Testing framework. I’m struggling to think any reason why that’d happen. The static linker should have either resolved that symbol to an export from one of your apps or frameworks, or failed with an error.

Do you have your own framework called Testing? Perhaps involved in your mocking infrastructure?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Unit tests fails to run on Xcode 16, but works fine on Xcode 15.4 and older Xcodes
 
 
Q