Using Unit Tests While Developing Static Libraries in Obj-C
Posted
by macinjosh
on Stack Overflow
See other posts from Stack Overflow
or by macinjosh
Published on 2010-04-24T18:55:17Z
Indexed on
2010/04/24
19:03 UTC
Read the original article
Hit count: 551
I'm developing a static library in Obj-C for a CocoaTouch project. I've added unit testing to my Xcode project by using the built in OCUnit framework. I can run tests successfully upon building the project and everything looks good. However I'm a little confused about something.
Part of what the static library does is to connect to a URL and download the resource there. I constructed a test case that invokes the method that creates a connection and ensures the connection is successful. However when my tests run a connection is never made to my testing web server (where the connection is set to go).
It seems my code is not actually being ran when the tests happen?
Also, I am doing some NSLog calls in the unit tests and the code they run, but I never see those. I'm new to unit testing so I'm obviously not fully grasping what is going on here. Can anyone help me out here?
P.S. By the way these are "Logical Tests" as Apple calls them so they are not linked against the library, instead the implementation files are included in the testing target.
© Stack Overflow or respective owner