Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unit testing an iPhone static library with XCode 3

I am writing a number of static libraries for the iPhone and wish also to have suites of unit tests. XCode 3 provides templates for both static libraries and unit tests but I am wondering how they should fit together in a static library project?

In my static library project I have created a target for unit testing but expect to also create an executable to kick off the unit tests than run against the classes in the static library.

What is the procedure for doing this?

like image 750
teabot Avatar asked Mar 01 '23 13:03

teabot


2 Answers

Note that some classes of tests (like anything that would rely on the system calls such as [UIApplication sharedApplication] working require a separate target, while pure logic tests do not.

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

like image 196
Kendall Helmstetter Gelner Avatar answered Mar 13 '23 07:03

Kendall Helmstetter Gelner


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

like image 43
Tarek Jradi Avatar answered Mar 13 '23 08:03

Tarek Jradi