Various helper classes to assist when testing for iOS and Mac OS X
Objective-C C



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