{"id":17105,"date":"2017-02-02T15:02:57","date_gmt":"2017-02-02T20:02:57","guid":{"rendered":"http:\/\/mjtsai.com\/blog\/?p=17105"},"modified":"2017-02-02T15:02:57","modified_gmt":"2017-02-02T20:02:57","slug":"xcode-8-3-waiting-in-xctest","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2017\/02\/02\/xcode-8-3-waiting-in-xctest\/","title":{"rendered":"Xcode 8.3: Waiting in XCTest"},"content":{"rendered":"<p><a href=\"http:\/\/masilotti.com\/xctest-waiting\/\">Joe Masilotti<\/a>:<\/p>\n<blockquote cite=\"http:\/\/masilotti.com\/xctest-waiting\/\">\n<p>At first glance <code>XCTestWaiter<\/code> is simply a new approach to waiting for <code>XCTestExpectation<\/code>s to fulfill. However, there are a few gems hidden beneath the surface.<\/p>\n<p>[&#8230;]<\/p>\n<p>A big advantage of this approach is that the test suite reads as a synchronous flow. There is no callback block or completion handler. The helper method simply returns a boolean indicating if the element appeared or not.<\/p>\n<p>[&#8230;]<\/p>\n<p>You are now completely in control of when and how to fail your tests if an expectation fails to fulfill. This enables waiting for optional elements, like a login screen or a location services authorization dialog.<\/p>\n<p>[&#8230;]<\/p>\n<p>Along with the new waiter class, <code>XCTestExpectations<\/code> was subclassed to make specific expectations a little easier to write.<\/p>\n<\/blockquote>\n<p>Previously: <a href=\"http:\/\/mjtsai.com\/blog\/2016\/03\/24\/xctestexpectation-gotchas\/\">XCTestExpectation Gotchas<\/a>, <a href=\"http:\/\/mjtsai.com\/blog\/2014\/09\/18\/xcode-6-0-1-asynchronous-tests\/\">Xcode 6.0.1 Asynchronous Tests<\/a>, <a href=\"http:\/\/mjtsai.com\/blog\/2014\/07\/22\/xctestcase-xctestexpectation-measureblock\/\">XCTest&#x200B;Case \/ XCTest&#x200B;Expectation \/ measure&#x200B;Block()<\/a>.<\/p>","protected":false},"excerpt":{"rendered":"<p>Joe Masilotti: At first glance XCTestWaiter is simply a new approach to waiting for XCTestExpectations to fulfill. However, there are a few gems hidden beneath the surface. [&#8230;] A big advantage of this approach is that the test suite reads as a synchronous flow. There is no callback block or completion handler. The helper method [&hellip;]<\/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":[31,1380,30,1381,71,901,268,226],"class_list":["post-17105","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-ios","tag-ios-10","tag-mac","tag-macos-10-12","tag-programming","tag-swift-programming-language","tag-testing","tag-xcode"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/17105","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=17105"}],"version-history":[{"count":1,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/17105\/revisions"}],"predecessor-version":[{"id":17106,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/17105\/revisions\/17106"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=17105"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=17105"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=17105"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}