{"id":8067806,"date":"2021-02-22T12:44:04","date_gmt":"2021-02-22T20:44:04","guid":{"rendered":"https:\/\/test-agilealliance.pantheonsite.io\/?post_type=aa_book&#038;p=8067806"},"modified":"2022-09-16T12:16:25","modified_gmt":"2022-09-16T19:16:25","slug":"ios-unit-testing-by-example-xctest-tips-and-techniques-using-swift","status":"publish","type":"aa_book","link":"https:\/\/agilealliance.org\/resources\/books\/ios-unit-testing-by-example-xctest-tips-and-techniques-using-swift\/","title":{"rendered":"iOS Unit Testing by Example: XCTest Tips and Techniques Using Swift"},"content":{"rendered":"<div>\n<div>\n<p>Fearlessly change the design of your iOS code with solid unit tests. Use Xcode\u2019s built-in test framework XCTest and Swift to get rapid feedback on all your code \u2014 including legacy code. Learn the tricks and techniques of testing all iOS code, especially view controllers (UIViewControllers), which are critical to iOS apps. Learn to isolate and replace dependencies in legacy code written without tests. Practice safe refactoring that makes these tests possible, and watch all your changes get verified quickly and automatically. Make even the boldest code changes with complete confidence.<\/p>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Fearlessly change the design of your iOS code with solid unit tests. Use Xcode\u2019s built-in test framework XCTest and Swift to get rapid feedback on all your code \u2014 including [&hellip;]<\/p>\n","protected":false},"author":8033092,"featured_media":8067808,"parent":0,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"","categories":[],"tags":[],"class_list":["post-8067806","aa_book","type-aa_book","status-publish","has-post-thumbnail","hentry"],"acf":[],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.10 - aioseo.com -->\n\t<meta name=\"description\" content=\"Fearlessly change the design of your iOS code with solid unit tests.\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Joe Foley\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/agilealliance.org\/resources\/books\/ios-unit-testing-by-example-xctest-tips-and-techniques-using-swift\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.10\" \/>\n\n\t\t<!-- Global site tag (gtag.js) - Google Analytics -->\n<script async src=\"https:\/\/www.googletagmanager.com\/gtag\/js?id=UA-17319182-1\"><\/script>\n<script>\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n\n gtag('config', 'UA-17319182-1');\n<\/script>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"Agile Alliance | Promoting a more effective, humane, and sustainable way of working\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"iOS Unit Testing by Example: XCTest Tips and Techniques Using Swift | Agile Alliance\" \/>\n\t\t<meta property=\"og:description\" content=\"Fearlessly change the design of your iOS code with solid unit tests.\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/agilealliance.org\/resources\/books\/ios-unit-testing-by-example-xctest-tips-and-techniques-using-swift\/\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/agilealliance.org\/wp-content\/uploads\/2021\/02\/iOS-unit-testing.png\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/agilealliance.org\/wp-content\/uploads\/2021\/02\/iOS-unit-testing.png\" \/>\n\t\t<meta property=\"og:image:width\" content=\"750\" \/>\n\t\t<meta property=\"og:image:height\" content=\"900\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2021-02-22T20:44:04+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2022-09-16T19:16:25+00:00\" \/>\n\t\t<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/agileallianceofficial\/\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n\t\t<meta name=\"twitter:site\" content=\"@AgileAlliance\" \/>\n\t\t<meta name=\"twitter:title\" content=\"iOS Unit Testing by Example: XCTest Tips and Techniques Using Swift | Agile Alliance\" \/>\n\t\t<meta name=\"twitter:description\" content=\"Fearlessly change the design of your iOS code with solid unit tests.\" \/>\n\t\t<meta name=\"twitter:image\" content=\"https:\/\/agilealliance.org\/wp-content\/uploads\/2021\/02\/iOS-unit-testing.png\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/agilealliance.org\\\/resources\\\/books\\\/ios-unit-testing-by-example-xctest-tips-and-techniques-using-swift\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/agilealliance.org#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/agilealliance.org\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/agilealliance.org\\\/resources\\\/books\\\/ios-unit-testing-by-example-xctest-tips-and-techniques-using-swift\\\/#listItem\",\"name\":\"iOS Unit Testing by Example: XCTest Tips and Techniques Using Swift\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/agilealliance.org\\\/resources\\\/books\\\/ios-unit-testing-by-example-xctest-tips-and-techniques-using-swift\\\/#listItem\",\"position\":2,\"name\":\"iOS Unit Testing by Example: XCTest Tips and Techniques Using Swift\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/agilealliance.org#listItem\",\"name\":\"Home\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/agilealliance.org\\\/#organization\",\"name\":\"Agile Alliance\",\"description\":\"Promoting a more effective, humane, and sustainable way of working\",\"url\":\"https:\\\/\\\/agilealliance.org\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/agilealliance.org\\\/wp-content\\\/uploads\\\/2025\\\/02\\\/pmi-aa-logo-temp.png\",\"@id\":\"https:\\\/\\\/agilealliance.org\\\/resources\\\/books\\\/ios-unit-testing-by-example-xctest-tips-and-techniques-using-swift\\\/#organizationLogo\",\"width\":798,\"height\":252,\"caption\":\"NOT FINAL\"},\"image\":{\"@id\":\"https:\\\/\\\/agilealliance.org\\\/resources\\\/books\\\/ios-unit-testing-by-example-xctest-tips-and-techniques-using-swift\\\/#organizationLogo\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/agileallianceofficial\\\/\",\"https:\\\/\\\/www.pinterest.com\\\/agilealliance\\\/_created\\\/\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/4860067\\\/admin\\\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/agilealliance.org\\\/author\\\/8033092#author\",\"url\":\"https:\\\/\\\/agilealliance.org\\\/author\\\/8033092\",\"name\":\"Joe Foley\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/agilealliance.org\\\/resources\\\/books\\\/ios-unit-testing-by-example-xctest-tips-and-techniques-using-swift\\\/#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/9b744f9896f53f67349efd7da65fa5757eb65e21af269329775a2157d9f73d78?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"Joe Foley\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/agilealliance.org\\\/resources\\\/books\\\/ios-unit-testing-by-example-xctest-tips-and-techniques-using-swift\\\/#webpage\",\"url\":\"https:\\\/\\\/agilealliance.org\\\/resources\\\/books\\\/ios-unit-testing-by-example-xctest-tips-and-techniques-using-swift\\\/\",\"name\":\"iOS Unit Testing by Example: XCTest Tips and Techniques Using Swift | Agile Alliance\",\"description\":\"Fearlessly change the design of your iOS code with solid unit tests.\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/agilealliance.org\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/agilealliance.org\\\/resources\\\/books\\\/ios-unit-testing-by-example-xctest-tips-and-techniques-using-swift\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/agilealliance.org\\\/author\\\/8033092#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/agilealliance.org\\\/author\\\/8033092#author\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/agilealliance.org\\\/wp-content\\\/uploads\\\/2021\\\/02\\\/iOS-unit-testing.png\",\"@id\":\"https:\\\/\\\/agilealliance.org\\\/resources\\\/books\\\/ios-unit-testing-by-example-xctest-tips-and-techniques-using-swift\\\/#mainImage\",\"width\":750,\"height\":900},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/agilealliance.org\\\/resources\\\/books\\\/ios-unit-testing-by-example-xctest-tips-and-techniques-using-swift\\\/#mainImage\"},\"datePublished\":\"2021-02-22T12:44:04-08:00\",\"dateModified\":\"2022-09-16T12:16:25-07:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/agilealliance.org\\\/#website\",\"url\":\"https:\\\/\\\/agilealliance.org\\\/\",\"name\":\"Agile Alliance\",\"description\":\"Promoting a more effective, humane, and sustainable way of working\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/agilealliance.org\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"iOS Unit Testing by Example: XCTest Tips and Techniques Using Swift | Agile Alliance","description":"Fearlessly change the design of your iOS code with solid unit tests.","canonical_url":"https:\/\/agilealliance.org\/resources\/books\/ios-unit-testing-by-example-xctest-tips-and-techniques-using-swift\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":"&lt;!-- Global site tag (gtag.js) - Google Analytics --&gt;\n&lt;script async src=\"https:\/\/www.googletagmanager.com\/gtag\/js?id=UA-17319182-1\"&gt;&lt;\/script&gt;\n&lt;script&gt;\n&nbsp;window.dataLayer = window.dataLayer || [];\n&nbsp;function gtag(){dataLayer.push(arguments);}\n&nbsp;gtag('js', new Date());\n\n&nbsp;gtag('config', 'UA-17319182-1');\n&lt;\/script&gt;"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"BreadcrumbList","@id":"https:\/\/agilealliance.org\/resources\/books\/ios-unit-testing-by-example-xctest-tips-and-techniques-using-swift\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/agilealliance.org#listItem","position":1,"name":"Home","item":"https:\/\/agilealliance.org","nextItem":{"@type":"ListItem","@id":"https:\/\/agilealliance.org\/resources\/books\/ios-unit-testing-by-example-xctest-tips-and-techniques-using-swift\/#listItem","name":"iOS Unit Testing by Example: XCTest Tips and Techniques Using Swift"}},{"@type":"ListItem","@id":"https:\/\/agilealliance.org\/resources\/books\/ios-unit-testing-by-example-xctest-tips-and-techniques-using-swift\/#listItem","position":2,"name":"iOS Unit Testing by Example: XCTest Tips and Techniques Using Swift","previousItem":{"@type":"ListItem","@id":"https:\/\/agilealliance.org#listItem","name":"Home"}}]},{"@type":"Organization","@id":"https:\/\/agilealliance.org\/#organization","name":"Agile Alliance","description":"Promoting a more effective, humane, and sustainable way of working","url":"https:\/\/agilealliance.org\/","logo":{"@type":"ImageObject","url":"https:\/\/agilealliance.org\/wp-content\/uploads\/2025\/02\/pmi-aa-logo-temp.png","@id":"https:\/\/agilealliance.org\/resources\/books\/ios-unit-testing-by-example-xctest-tips-and-techniques-using-swift\/#organizationLogo","width":798,"height":252,"caption":"NOT FINAL"},"image":{"@id":"https:\/\/agilealliance.org\/resources\/books\/ios-unit-testing-by-example-xctest-tips-and-techniques-using-swift\/#organizationLogo"},"sameAs":["https:\/\/www.facebook.com\/agileallianceofficial\/","https:\/\/www.pinterest.com\/agilealliance\/_created\/","https:\/\/www.linkedin.com\/company\/4860067\/admin\/"]},{"@type":"Person","@id":"https:\/\/agilealliance.org\/author\/8033092#author","url":"https:\/\/agilealliance.org\/author\/8033092","name":"Joe Foley","image":{"@type":"ImageObject","@id":"https:\/\/agilealliance.org\/resources\/books\/ios-unit-testing-by-example-xctest-tips-and-techniques-using-swift\/#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/9b744f9896f53f67349efd7da65fa5757eb65e21af269329775a2157d9f73d78?s=96&d=mm&r=g","width":96,"height":96,"caption":"Joe Foley"}},{"@type":"WebPage","@id":"https:\/\/agilealliance.org\/resources\/books\/ios-unit-testing-by-example-xctest-tips-and-techniques-using-swift\/#webpage","url":"https:\/\/agilealliance.org\/resources\/books\/ios-unit-testing-by-example-xctest-tips-and-techniques-using-swift\/","name":"iOS Unit Testing by Example: XCTest Tips and Techniques Using Swift | Agile Alliance","description":"Fearlessly change the design of your iOS code with solid unit tests.","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/agilealliance.org\/#website"},"breadcrumb":{"@id":"https:\/\/agilealliance.org\/resources\/books\/ios-unit-testing-by-example-xctest-tips-and-techniques-using-swift\/#breadcrumblist"},"author":{"@id":"https:\/\/agilealliance.org\/author\/8033092#author"},"creator":{"@id":"https:\/\/agilealliance.org\/author\/8033092#author"},"image":{"@type":"ImageObject","url":"https:\/\/agilealliance.org\/wp-content\/uploads\/2021\/02\/iOS-unit-testing.png","@id":"https:\/\/agilealliance.org\/resources\/books\/ios-unit-testing-by-example-xctest-tips-and-techniques-using-swift\/#mainImage","width":750,"height":900},"primaryImageOfPage":{"@id":"https:\/\/agilealliance.org\/resources\/books\/ios-unit-testing-by-example-xctest-tips-and-techniques-using-swift\/#mainImage"},"datePublished":"2021-02-22T12:44:04-08:00","dateModified":"2022-09-16T12:16:25-07:00"},{"@type":"WebSite","@id":"https:\/\/agilealliance.org\/#website","url":"https:\/\/agilealliance.org\/","name":"Agile Alliance","description":"Promoting a more effective, humane, and sustainable way of working","inLanguage":"en-US","publisher":{"@id":"https:\/\/agilealliance.org\/#organization"}}]},"og:locale":"en_US","og:site_name":"Agile Alliance | Promoting a more effective, humane, and sustainable way of working","og:type":"article","og:title":"iOS Unit Testing by Example: XCTest Tips and Techniques Using Swift | Agile Alliance","og:description":"Fearlessly change the design of your iOS code with solid unit tests.","og:url":"https:\/\/agilealliance.org\/resources\/books\/ios-unit-testing-by-example-xctest-tips-and-techniques-using-swift\/","og:image":"https:\/\/agilealliance.org\/wp-content\/uploads\/2021\/02\/iOS-unit-testing.png","og:image:secure_url":"https:\/\/agilealliance.org\/wp-content\/uploads\/2021\/02\/iOS-unit-testing.png","og:image:width":750,"og:image:height":900,"article:published_time":"2021-02-22T20:44:04+00:00","article:modified_time":"2022-09-16T19:16:25+00:00","article:publisher":"https:\/\/www.facebook.com\/agileallianceofficial\/","twitter:card":"summary_large_image","twitter:site":"@AgileAlliance","twitter:title":"iOS Unit Testing by Example: XCTest Tips and Techniques Using Swift | Agile Alliance","twitter:description":"Fearlessly change the design of your iOS code with solid unit tests.","twitter:image":"https:\/\/agilealliance.org\/wp-content\/uploads\/2021\/02\/iOS-unit-testing.png"},"aioseo_meta_data":{"post_id":"8067806","title":null,"description":"Fearlessly change the design of your iOS code with solid unit tests.","keywords":[],"keyphrases":{"focus":{"keyphrase":"","score":0,"analysis":{"keyphraseInTitle":{"score":0,"maxScore":9,"error":1}}},"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":"Fearlessly change the design of your iOS code with solid unit tests.","og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":null,"og_article_tags":[],"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":"Fearlessly change the design of your iOS code with solid unit tests.","schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[],"defaultGraph":"","defaultPostTypeGraph":""},"schema_type":"none","schema_type_options":"{\"article\":{\"articleType\":\"BlogPosting\"},\"course\":{\"name\":\"\",\"description\":\"\",\"provider\":\"\"},\"faq\":{\"pages\":[]},\"product\":{\"reviews\":[]},\"recipe\":{\"ingredients\":[],\"instructions\":[],\"keywords\":[]},\"software\":{\"reviews\":[],\"operatingSystems\":[]},\"webPage\":{\"webPageType\":\"WebPage\"},\"blockGraphs\":[],\"book\":[],\"event\":[],\"jobPosting\":[],\"music\":[],\"person\":[],\"restaurant\":[],\"service\":[],\"video\":[]}","pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":"-1","robots_max_videopreview":"-1","robots_max_imagepreview":"large","priority":null,"frequency":"default","local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"ai":null,"created":"2021-02-22 20:35:26","updated":"2025-06-23 07:05:23","seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/agilealliance.org\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tiOS Unit Testing by Example: XCTest Tips and Techniques Using Swift\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/agilealliance.org"},{"label":"iOS Unit Testing by Example: XCTest Tips and Techniques Using Swift","link":"https:\/\/agilealliance.org\/resources\/books\/ios-unit-testing-by-example-xctest-tips-and-techniques-using-swift\/"}],"_links":{"self":[{"href":"https:\/\/agilealliance.org\/wp-json\/wp\/v2\/aa_book\/8067806","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/agilealliance.org\/wp-json\/wp\/v2\/aa_book"}],"about":[{"href":"https:\/\/agilealliance.org\/wp-json\/wp\/v2\/types\/aa_book"}],"author":[{"embeddable":true,"href":"https:\/\/agilealliance.org\/wp-json\/wp\/v2\/users\/8033092"}],"replies":[{"embeddable":true,"href":"https:\/\/agilealliance.org\/wp-json\/wp\/v2\/comments?post=8067806"}],"version-history":[{"count":0,"href":"https:\/\/agilealliance.org\/wp-json\/wp\/v2\/aa_book\/8067806\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/agilealliance.org\/wp-json\/wp\/v2\/media\/8067808"}],"wp:attachment":[{"href":"https:\/\/agilealliance.org\/wp-json\/wp\/v2\/media?parent=8067806"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/agilealliance.org\/wp-json\/wp\/v2\/categories?post=8067806"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/agilealliance.org\/wp-json\/wp\/v2\/tags?post=8067806"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}