Various helper classes to assist when testing for iOS and Mac OS X
Objective-C C
Failed to load latest commit information.
ILCannedURLProtocol.h Added blocks as alternative to delegate methods Mar 1, 2013
ILCannedURLProtocolTests.h Added delegate Jul 10, 2012
ILCannedURLProtocolTests.m Fixed type conflict in test Jul 11, 2014
ILProfilerCompat.c Workaround for missing fopen$UNIX2003 Feb 11, 2012
ILTestImage.h Test of drawing behavior using NSImage Apr 21, 2012
README.mdown Fix spelling error Feb 12, 2012



ILTesting provides a collection of Objective C helper classes primarily for assisting with testing. That is, if you can call the current content of one class a collection.


ILCannedURLProtocol is intended for unit and mock testing of code that makes http requests. It will intercept the standard http protocol and respond with a predefined set of test data every time the test is executed. This way any outside influences can be eliminated from the test results.

In order to use ILCannedURLProtocol, insert the following code in your test case before executing the code under test:

[NSURLProtocol registerClass:[ILCannedURLProtocol class]];
[ILCannedURLProtocol setCannedStatusCode:200];
[ILCannedURLProtocol setCannedHeaders:testHeaders];
[ILCannedURLProtocol setCannedResponseData:testData];

Make sure to unregister the ILCannedURLProtocol after each use:

[NSURLProtocol unregisterClass:[ILCannedURLProtocol class]];

See also:


This file provides a workaround for an error that sometimes occurs when enabling code coverage metrics on iOS using LLVM/Clang and libprofile_rt.dylib:

Detected an attempt to call a symbol in system libraries that is not present on the iPhone: fopen$UNIX2003 called from function llvm_gcda_start_file in image ...

To fix this problem simply include this file in your testing target build.

Feel free to add enhancements, bug fixes, etc. and provide them back to the community!


Claus Broch