{"id":9209,"date":"2014-07-22T15:12:04","date_gmt":"2014-07-22T19:12:04","guid":{"rendered":"http:\/\/mjtsai.com\/blog\/?p=9209"},"modified":"2014-07-22T15:12:04","modified_gmt":"2014-07-22T19:12:04","slug":"xctestcase-xctestexpectation-measureblock","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2014\/07\/22\/xctestcase-xctestexpectation-measureblock\/","title":{"rendered":"XCTest&#8203;Case \/ XCTest&#8203;Expectation \/ measure&#8203;Block()"},"content":{"rendered":"<p><a href=\"http:\/\/nshipster.com\/xctestcase\/\">Mattt Thompson<\/a>:<\/p>\n<blockquote cite=\"http:\/\/nshipster.com\/xctestcase\/\"><p>With Xcode 6, we&rsquo;ve finally arrived: <strong>the built-in testing tools are now good enough to use on their own<\/strong>. That is to say, there are no particularly compelling reasons to use any additional abstractions in order to provide acceptable test coverage for the vast majority apps and libraries. Except in extreme cases that require extensive stubbing, mocking, or other exotic test constructs, XCTest assertions, expectations, and performance measurements should be sufficient.<\/p><\/blockquote>\n<p>I do find it helpful to use additional macros to make the assertions more concise. For example, I use <code>EQ()<\/code> instead of <code>XCTAssertEqualObjects()<\/code>. This was also nice because I didn&rsquo;t have to change all my code when Apple renamed its macros. I also have macros like <code>EQARRAY()<\/code> that make it easier to see <em>how<\/em> the failing object differs from the expected one. And I have ones for structs like <code>NSPoint<\/code> because Apple removed support for those with <code>XCTAssertEqual()<\/code> and never added it back.<\/p>","protected":false},"excerpt":{"rendered":"<p>Mattt Thompson: With Xcode 6, we&rsquo;ve finally arrived: the built-in testing tools are now good enough to use on their own. That is to say, there are no particularly compelling reasons to use any additional abstractions in order to provide acceptable test coverage for the vast majority apps and libraries. Except in extreme cases that [&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":[75,30,32,941,71,268,226],"class_list":["post-9209","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-developertool","tag-mac","tag-macapp","tag-macros","tag-programming","tag-testing","tag-xcode"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/9209","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=9209"}],"version-history":[{"count":1,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/9209\/revisions"}],"predecessor-version":[{"id":9210,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/9209\/revisions\/9210"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=9209"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=9209"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=9209"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}