IPhone Static Library Testing Module with Xcode 3

I am writing several static libraries for the iPhone and wish to have a set of unit tests as well. Xcode 3 provides templates for both static libraries and unit tests, but I wonder how they should fit in a static library design?

In my static library project, I created a goal for unit testing, but I also expect to create an executable file to run unit tests, and not for classes in a static library.

What is the procedure for doing this?

+4
source share
3 answers

Note that some test classes (for example, anything that relies on system calls, such as [UIApplication sharedApplication], require a separate purpose, while pure logic tests do not.

Create a new project using Unit Test and see what is added - basically you can do the same thing easily, create a new goal and select “Unit Test Bundle” as the target type.

+7
source

you need to add all your .m files to the unit test target. (Just drag and drop!)

+2
source

If people still have problems using static libraries:

I created an article that explains how to create static libraries and how to use them in projects:

Xcode: full explanation of how to use static libraries: http://www.sodeso.nl/?p=822

And for partial testing of some of the static libraries, I don’t have explanations on how to configure it, but I created a static library template that uses the Google Toolkit for Map unit platform, which you can download and add to your Xcode installation:

Xcode: static library template using Google Toolkit for Mac: http://www.sodeso.nl/?p=982

-1
source

All Articles