Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xcode 6.0.1 fails to load test bundle for **iOS** application test target #570

Open
joshuatbrown opened this issue Sep 22, 2014 · 13 comments

Comments

@joshuatbrown
Copy link
Contributor

I'm having what appears to be a similar issue as #565 - my test bundle doesn't load in Xcode 6. It's an iOS app that's been around for a while, and I'm using CocoaPods to pull Kiwi in. Here's my environment:

  • Xcode 6.0.1
  • Kiwi 2.3.0 (I've tried HEAD as well)
  • CocoaPods
  • iPhone 6 Simulator (iOS 8)

And here's the error message:

IDEBundleInjection.c: Error 3587 loading bundle '/Users/josh/Library/Developer/Xcode/DerivedData/MyApp-eqkdocnxomrmqdcpsvnruhralyhf/Build/Products/Test-iphonesimulator/MyAppTests.octest': The bundle “MyAppTests.octest” couldn’t be loaded because it is damaged or missing necessary resources.
DevToolsBundleInjection environment:
XCInjectDiagnostics: (null)
XCInjectBundleInto: /Users/josh/Library/Developer/Xcode/DerivedData/MyApp-eqkdocnxomrmqdcpsvnruhralyhf/Build/Products/Test-iphonesimulator/MyApp.app/MyApp
XCInjectBundle: /Users/josh/Library/Developer/Xcode/DerivedData/MyApp-eqkdocnxomrmqdcpsvnruhralyhf/Build/Products/Test-iphonesimulator/MyAppTests.octest
TestBundleLocation: /Users/josh/Library/Developer/Xcode/DerivedData/MyApp-eqkdocnxomrmqdcpsvnruhralyhf/Build/Products/Test-iphonesimulator/MyAppTests.octest
TMPDIR: /Users/josh/Library/Developer/CoreSimulator/Devices/EDC94527-6C09-4DD9-ACFA-EA8F55316D4E/data/Containers/Data/Application/0A2BD137-EF66-4D2D-8EFA-24145EFA64AB/tmp
DYLD_LIBRARY_PATH: /Users/josh/Library/Developer/Xcode/DerivedData/MyApp-eqkdocnxomrmqdcpsvnruhralyhf/Build/Products/Test-iphonesimulator
DYLD_INSERT_LIBRARIES: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/PrivateFrameworks/IDEBundleInjection.framework/IDEBundleInjection
DYLD_FRAMEWORK_PATH: /Users/josh/Library/Developer/Xcode/DerivedData/MyApp-eqkdocnxomrmqdcpsvnruhralyhf/Build/Products/Test-iphonesimulator
Test target MyAppTests encountered an error (Test process exited with code 82)
@joshuatbrown
Copy link
Contributor Author

I tried deleting Derived Data and testing in the iPhone 5s (7.0.3) simulator, but that didn't work either.

@ajimix
Copy link

ajimix commented Sep 23, 2014

Same issue here...

@joshuatbrown
Copy link
Contributor Author

I was able to work around this by doing the following:

  1. Create a new iOS Application target - MyApp2, for example (this automatically creates a unit tests target)
  2. Change the unit tests target to point to the main app target - MyApp, for example
  3. Update the Podfile to include the following:
target :MyApp2Tests, :exclusive => true do
    pod 'Kiwi'
end
  1. Run pod install
  2. Add all the Kiwi specs to the new unit test target - MyApp2Tests
  3. Update the MyApp scheme to use MyApp2Tests for testing instead of MyAppTests

I think that's all, but I'm probably forgetting something... If you see errors or have questions, feel free to post them here and I'll do my best to help.

@tjarratt
Copy link

Hmm ... I saw this a few times when working on Cedar, adding support for Xcode 6.

@joshuatbrown -- can you try changing the "Wrapper Extension" for your test bundle from octest to xctest?

Here's a screenshot of the setting in an example project I just created (down at the bottom):
screen shot 2014-10-10 at 5 53 22 pm

My understanding is that prior to Xcode 6, the extension for test bundles was .octest and now it's .xctest and that Xcode will not load test bundles with the .octest extension.

@seboslaw
Copy link

@tjarratt this worked for me. thx!!!

@joshuatbrown
Copy link
Contributor Author

@tjarratt I've already deleted my old test target in favor of my workaround from my previous comment, so I can't try that any more.

@tjarratt
Copy link

@joshuatbrown if you are using git (or some other version control) for your project then you could check out an earlier commit, before you deleted the test target and try that out.

Just a thought.

@sharplet
Copy link
Contributor

Hey everyone, is this still an issue? Would appreciate if someone could try on Kiwi 2.3.1 / Xcode 6.1 and let me know how it goes.

@tjarratt
Copy link

tjarratt commented Dec 7, 2014

Hey @sharplet the interesting thing about this issue is that it should happen to anyone that takes an existing project (with Kiwi tests) from Xcode 5 and upgrades to Xcode 6. The extension for test bundles changed from .octest to .xctest and Xcode cowardly refuses to run the tests because it doesn't know how to use a test bundle with the older extension.

I'm not aware of any fix that Kiwi could apply to fix this, but would love to know if there was one. The problem, as I see it, is that the project build configuration needs to be changed (so that the test bundle's extension is updated for Xcode 6). Since the failure occurs when the test bundle is injected, I don't think there's any way at all for Kiwi to quickly go and fix it at runtime.

Is there a FAQ section for common problems when upgrading between Xcode versions? You might want to just document this as an Xcode defect.

@iwasrobbed
Copy link

@tjarratt Changing the wrapper extension to xctest worked perfectly. Thanks.

@amol-c
Copy link

amol-c commented Aug 21, 2015

So, the reason it turned out it wasn't working is that the frameworks were not copied under build phase.
screen shot 2015-08-21 at 11 55 50 am

@sharplet
Copy link
Contributor

@amol-c I have seen that issue before, but I think that's different to @joshuatbrown's original issue.

Speaking of which, is it still happening or did @tjarrat's fix work?

@dalu93
Copy link

dalu93 commented Aug 27, 2015

Hi,

I'm spending a lot of time looking for a workaround. I'm using an existing workspace and Cocoapods and now I'm adding the XCTest target, but when I ran this on iPhone6 simulator, it says

IDEBundleInjection.c: Error 3585 loading bundle 'PATH/TO/File.xctest': The bundle “TargetTest” couldn’t be loaded because it doesn’t contain a version for the current architecture.

While on other simulators (as iPhone4 and iPhone5 with different iOS version) it works fine.
Do you know something about this error? I also set Build Active Architecture Only to NO

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants