{"id":9671,"date":"2014-09-18T19:39:18","date_gmt":"2014-09-18T23:39:18","guid":{"rendered":"http:\/\/mjtsai.com\/blog\/?p=9671"},"modified":"2014-09-19T10:18:07","modified_gmt":"2014-09-19T14:18:07","slug":"xcode-6-0-1-asynchronous-tests","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2014\/09\/18\/xcode-6-0-1-asynchronous-tests\/","title":{"rendered":"Xcode 6.0.1 Asynchronous Tests"},"content":{"rendered":"<p>The <a href=\"https:\/\/developer.apple.com\/library\/ios\/documentation\/DeveloperTools\/Conceptual\/testing_with_xcode\/testing_3_writing_test_classes\/testing_3_writing_test_classes.html#\/\/apple_ref\/doc\/uid\/TP40014132-CH4-SW6\">documentation<\/a> only shows one type of <code>XCTestExpectation<\/code>, but there are actually several different methods for creating them:<\/p>\n<pre>\n@interface XCTestCase (AsynchronousTesting)\n- (XCTestExpectation *)expectationWithDescription:(NSString *)description;\n- (XCTestExpectation *)keyValueObservingExpectationForObject:(id)objectToObserve \n                                                     keyPath:(NSString *)keyPath \n                                               expectedValue:(id)expectedValue;\n- (XCTestExpectation *)keyValueObservingExpectationForObject:(id)objectToObserve \n                                                     keyPath:(NSString *)keyPath \n                                                     handler:(XCKeyValueObservingExpectationHandler)handlerOrNil;\n- (XCTestExpectation *)expectationForNotification:(NSString *)notificationName \n                                           object:(id)objectToObserve \n                                          handler:(XCNotificationExpectationHandler)handlerOrNil;\n@end\n<\/pre>\n<p>These are documented in <tt>XCTextCase+AsynchronousTesting.h<\/tt>.<\/p>","protected":false},"excerpt":{"rendered":"<p>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.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"","apple_news_api_id":"","apple_news_api_modified_at":"","apple_news_api_revision":"","apple_news_api_share_url":"","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[4],"tags":[75,31,30,54,71,268,226],"class_list":["post-9671","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-developertool","tag-ios","tag-mac","tag-objective-c","tag-programming","tag-testing","tag-xcode"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/9671","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=9671"}],"version-history":[{"count":1,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/9671\/revisions"}],"predecessor-version":[{"id":9672,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/9671\/revisions\/9672"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=9671"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=9671"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=9671"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}