Unit testing in Xcode 3.1

By : aku
Source: Stackoverflow.com
Question!

I read the question on 'The best way to unit test Objective-C and followed the instructions, but no matter what I do, the Unit tests do not run. Actually the entire program does not run, I get the following message.

dyld: Library not loaded: @rpath/SenTestingKit.framework/Versions/A/SenTestingKit Referenced from /Users/garethlewis/work/objc/UnitTesting/build/Debug/UnitTesting Reason: image not found

I have set the DYLD_FALLBACK_FRAMEWORK_PATH variable, and also the XCInjectBundle as well as the DYLD_INSERT_LIBRARIES and added the variable -SenTest All.

I can't have the only installation of Xcode 3.1 that Unit testing fails on.

Can someone who has managed to get Unit Testing on Xcode 3.1 working give some details on what needs to be done. It would help so much, with what I am trying to do.

By : aku


Answers

You don't need to do this stuff to just run your tests.

If you're writing tests for an application, you should just need to set the Test Host and Bundle Loader build settings for your unit test bundle target and they will be run as part of your build. If you're writing tests for a framework you don't even need to do that, just make sure your test bundle links against your framework.

I assume you're actually talking about debugging your tests, not just running them. If so, it's important to give us the following information:

  • what kind of tests — application or framework — you're trying to debug
  • what environment variables you set, and what values you set them to
  • what arguments you set (-SenTest All should be an argument, not environment variable)
  • what the full error shown in your debug console is, not just the specific failure

That will help diagnose what's going on.

At first glance, it looks like you might have a typo in your DYLD_FALLBACK_FRAMEWORK_PATH because that determines where dyld will look for the SenTestingKit.framework binary if @rpath cannot be resolved. Knowing what it's set to will probably help.

(PS - It's Xcode.)



This video can help you solving your question :)
By: admin