shizhen
shizhen

Reputation: 12583

Unable to initialize test bundle xcode unit test

I am running into this failure from Xcode 9.1 when I try to run unit test. The full error log is as below:


2018-08-20 14:15:23.907432+0800 module-Core-TestHost[58581:15107793] Unable to initialize test bundle from file:///Users/russell/finder/sdk/dev/module/ios/Build/Products/Debug_MemoryGuard-iphonesimulator/module-Core-TestHost.app/PlugIns/module-Core-UnitTest.xctest/
    2018-08-20 14:15:23.911047+0800 module-Core-TestHost[58581:15107793] IDEBundleInjection Arguments: (
        "/Users/russell/Library/Developer/CoreSimulator/Devices/CD5368D2-AB15-4349-81DB-C8B96EB74272/data/Containers/Bundle/Application/3DE8BB53-4825-41FC-8F1C-6299B0C37BE8/module-Core-TestHost.app/module-Core-TestHost",
        "-NSTreatUnknownArgumentsAsOpen",
        NO,
        "-ApplePersistenceIgnoreState",
        YES
    )
    2018-08-20 14:15:23.913488+0800 module-Core-TestHost[58581:15107793] IDEBundleInjection Environment: {
        "CFFIXED_USER_HOME" = "/Users/russell/Library/Developer/CoreSimulator/Devices/CD5368D2-AB15-4349-81DB-C8B96EB74272/data/Containers/Data/Application/81029121-53FF-4C7D-8689-1B8A43D5B172";
        CLASSIC = 0;
        "CUPS_SERVER" = "/private/tmp/com.apple.launchd.J5oMC8Wk3T/Listeners";
        "DYLD_FALLBACK_FRAMEWORK_PATH" = "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks";
        "DYLD_FALLBACK_LIBRARY_PATH" = "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib";
        "DYLD_FRAMEWORK_PATH" = "/Users/russell/finder/sdk/dev/module/ios/Build/Products/Debug_MemoryGuard-

---

**Unable to initialize test bundle from file:///Users/russell/finder/sdk/dev/module/ios/Build/Products/Debug_MemoryGuard-iphonesimulator/module-Core-TestHost.app/PlugIns/module-Core-UnitTest.xctest/**

Anyone has idea about this error? Thanks!

Upvotes: 3

Views: 1904

Answers (1)

shizhen
shizhen

Reputation: 12583

After a few hours of research, I finally solved my problem from below steps:

From Xcode, File -> Workspace Settings... -> Advanced... -> Build Location (Select "Unique" option)

The reason is because that the Xcode build intermediate files are not in the correct paths. By selecting above option, all those files went into the correct directories and my problems got solved.

Upvotes: 0

Related Questions