views:

128

answers:

1

Is it possible to create a simple objective C object in xcode that has some basic test code, and then execute just this object, ala execute an alternative main()?

ie I have an LdapWrapper class and I want to write an LdapWrapperTest class that I can run on demand (it cant be part of the build process as it depends on access to an ldap server)

+2  A: 

Test Driving Your Code with OCUnit

It's a bit old, but the basics probably haven't changed that much. There's also an "XCode Unit Testing Guide" accessible from the documentation system. Essentially, what you want to do is add another target to your project. This will be built and run separately from your application. The unit testing system probably handles most of the follow-up questions you were going to ask.