Hi all,
I'm having a problem using the Xcode 7 unit testing with a Swift-based command line tool on Mac OS X. I've narrowed down the problem to what has to be a bug in Xcode 7 (reported to Apple); it seems that it's missing some symbols in the unit test bundle. Using xcodebuild xcrun on my test bundle yields:
xcrun xctest ~/Library/Developer/Xcode/DerivedData/SwiftCmdLine-bhvuxytwbqgvhwcustczucmynqko/Build/Products/Debug/Tester.xctest
2015-09-08 22:58:27.298 xctest[61315:4942885] The test bundle at /Users/rmcgann/Library/Developer/Xcode/DerivedData/SwiftCmdLine-bhvuxytwbqgvhwcustczucmynqko/Build/Products/Debug/Tester.xctest could not be loaded because a link error occurred. It is likely that dyld cannot locate a framework framework or library that the the test bundle was linked against, possibly because the framework or library had an incorrect install path at link time.
2015-09-08 22:58:27.298 xctest[61315:4942885] Detailed error information: Error Domain=NSCocoaErrorDomain Code=3588 "The bundle “Tester” couldn’t be loaded." (dlopen(/Users/rmcgann/Library/Developer/Xcode/DerivedData/SwiftCmdLine-bhvuxytwbqgvhwcustczucmynqko/Build/Products/Debug/Tester.xctest/Contents/MacOS/Tester, 265): Symbol not found: __TWVBOI'm not sure what the missing symbols are for; I can see them compiled into the actual command line binary, but not the unit test bundle.
Xcode 7 doesnt't have a template for unit testing command line tools, so I had to reverse engineer how Xcode sets up unit testing for Swift UI applications. Basically I had to set the 'Test Host' to the command the tool, and set the bundle loader to $(TEST_HOST). Once done, the unit test bundle compiles and links, but I get the aforementioned link errors. If I remove the 'Test Host', the unit test fails to run at all--Xcode just says "Unit test failed" without actually running anything. The bundle loader is required so that Xcode can find the symbols I'm unit testing; otherwise I have to add all the relevant code from the test tool to the unit test bundle.
Anybody else encountered this problem and if so, how did you work around it?