2

I have a GHUnit test target, TestGH, which I'd like to use to test classes in my application, TestApp. I'm using Xcode 4.5 and trying to run TestGH on iPad 6.0 Simulator.

I believe I've configured the TestGH build correctly in the Build Settings and Build Phases. I've set the Target Dependencies to "TestApp" I've added the *.m files for the classes I'd like to test--along with the test case classes which will test them--to the Compile Sources section TestGH.

Other notable configuration:

In the app target, TestApp:

Symbols Hidden By Default: No
Product Name: TestApp

In the test target, TestGH:

Bundle Loader: $(BUILT_PRODUCTS_DIR)/TestApp.app/TestApp
Mach-O Type: Bundle
Other linker flags: -ObjC, -all_load
Product name: TestGH
Test Host: $(BUNDLE_LOADER)

I suppose I have this mostly right, as I discovered these settings by fighting through compile/link errors, reading stackoverflow, and blogs.

However, when I launch TestGH, the Log Navigator shows: error: failed to attach to process ID 2305 (2305 corresponds to 'sh' according to activity monitor, fyi)

Simulator screen remains black, and Xcode shows "Attaching to TestGH" in the status.

Any ideas?

I've gone through many suggested fixes/workarounds I've seen discussed here related to "failed to attach to process."

Deleted DerivedData folder in Library/Developer/Xcode, deleted everything under Library/Application Support/iPhone Simulator. Tried all the options under Product->Edit Scheme for the TestGH target--tried Debugger = GDB, LLDB, None, Launch = Automatically, wait. Results are always the same.

  • 1
    Hi, I did resolve this eventually, thanks for asking. Here's what you need to do: leave the app target settings same as above. However, in the test target, do not set the Bundle Loader flag. Set the Mach-0 Type to Executable. Do not set the Test Host flag. And that's it! Test target should launch now with no issues. – Fabrizio Machado Jan 17 '13 at 10:44
  • Oh great! I really liked the GHUnit but I didn't want to copy every dependency manually. I will try this! – mkral Jan 17 '13 at 15:55
  • Sorry I just re-read this, did you still have to add the `.m` files to your compile sources? That is what I'm trying to avoid. – mkral Jan 17 '13 at 15:59
  • Hello mkral. Sadly, you will have to add the .m files to your test target compile sources. It's not what I wanted either, but this is the only way. – Fabrizio Machado Jan 22 '13 at 18:03
  • That's unfortunate. I decided to just use OCUnit although I did like the interface of GHUnit. – mkral Jan 22 '13 at 19:26

0 Answers0