Thursday, September 18, 2014

Xcode 6.0.1 Asynchronous Tests

The documentation only shows one type of XCTestExpectation, but there are actually several different methods for creating them:

@interface XCTestCase (AsynchronousTesting)
- (XCTestExpectation *)expectationWithDescription:(NSString *)description;
- (XCTestExpectation *)keyValueObservingExpectationForObject:(id)objectToObserve 
                                                     keyPath:(NSString *)keyPath 
                                               expectedValue:(id)expectedValue;
- (XCTestExpectation *)keyValueObservingExpectationForObject:(id)objectToObserve 
                                                     keyPath:(NSString *)keyPath 
                                                     handler:(XCKeyValueObservingExpectationHandler)handlerOrNil;
- (XCTestExpectation *)expectationForNotification:(NSString *)notificationName 
                                           object:(id)objectToObserve 
                                          handler:(XCNotificationExpectationHandler)handlerOrNil;
@end

These are documented in XCTextCase+AsynchronousTesting.h.

3 Comments RSS · Twitter

FWIW, @mattstevens has published an XCTest Xcode 5.0 to Xcode 6.0 API diff https://twitter.com/mattstevens/status/512651416654340096 generated from his objc-diff tool https://github.com/mattstevens/objc-diff

[…] iOS8 Day-by-Day :: Day 11 :: Asynchronous Testing; Asynchronous Testing With Xcode 6; Xcode 6.0.1 Asynchronous Tests […]

Leave a Comment