Easy iOS/Mac Asynchronous Unit Testing
Easy async unit testing, that doesn't require a framework composed of several files, it can be done with one.
Sample test case:
// This Test Case class uses CBAsyncTestCase as the base class
@implementation MyTestCase
- (void)testNetworkStuff
{
[self beginAsyncOperation]
NSString *identifier = @"777"
[_networkManager fetchStuffWithID:identifier completion:^(NSArray *results, NSError *error) {
STAssertNil(error, @"error occurred: %@", error);
STAssertTrue(results.count, @"no results");
[self finishedAsyncOperation];
}];
// waits for async operation or timeout and fail assertion
[self assertAsyncOperationTimeout];
}
@end
Written by C. Bess
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Mac
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#