• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Unit testing a Cocoa framework with XCode 3.1.1
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Unit testing a Cocoa framework with XCode 3.1.1


  • Subject: Re: Unit testing a Cocoa framework with XCode 3.1.1
  • From: Chris Hanson <email@hidden>
  • Date: Mon, 06 Oct 2008 19:21:38 -0700

On Oct 6, 2008, at 2:41 PM, Cyrus Najmabadi wrote:

I'm currently in the process of creating a cocoa framework that will allow you to read and write Google's ProtocolBuffer format.  The library has been written, and seems to be working ok, so i've moved on to the part where i want ot write a bunch of unit tests to verify behavior, and also to catch regressions.  However, i've finding myself commonly blocked while trying to do this, and no amount of Googling has been able to get my through the issues i'm running into.  I'm hoping that people here can help me

This issue you're running into is related to how Mac OS X deals with dynamic (shared) libraries, not really anything to do with unit testing.

At build time, a dynamic library gets an "install name" embedded within it that corresponds to the path at which it expects to be deployed.  When another binary links against a library, the library's install name is copied into the binary, and the loader will attempt to locate the library at that path.

You're encountering this when trying to create unit tests, rather than when you're trying to use your library, because:

Right now i have the following structure:

ProtocolBuffers.xcodeproj
Contains all of the real code for the framework and produces ProtocolBuffers.framework

ProtocolBuffers-Test.xcodeproj
This has an external framework reference to the framework produced by the previous project.

You should create the unit test bundle target in the same project as the framework target it contains tests for.  The unit testing infrastructure in Xcode is really designed to work with the tests alongside whatever they're testing, not in separate projects.

That way tests have full access to the internals of whatever they're testing — after all, internals and public interfaces should both be tested — and you don't have to mess about with copying code-under-test into the test bundle's build folder or anything like that.

  -- Chris

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Unit testing a Cocoa framework with XCode 3.1.1 (From: "Cyrus Najmabadi" <email@hidden>)

  • Prev by Date: Re: Using an Xcode 3.1.1 project with Xcode 2.4.1
  • Next by Date: Re: IB Plugin - Crash on window resize
  • Previous by thread: Unit testing a Cocoa framework with XCode 3.1.1
  • Next by thread: Using an Xcode 3.1.1 project with Xcode 2.4.1
  • Index(es):
    • Date
    • Thread