{"id":1765,"date":"2008-08-03T15:10:04","date_gmt":"2008-08-03T19:10:04","guid":{"rendered":"http:\/\/mjtsai.com\/blog\/?p=1765"},"modified":"2024-07-17T11:21:57","modified_gmt":"2024-07-17T15:21:57","slug":"unit-testing-roadblocks","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2008\/08\/03\/unit-testing-roadblocks\/","title":{"rendered":"Unit Testing Roadblocks"},"content":{"rendered":"<p><a href=\"http:\/\/www.red-sweater.com\/blog\/536\/unit-testing-roadblocks\">Daniel Jalkut<\/a>:<\/p>\n<blockquote cite=\"http:\/\/www.red-sweater.com\/blog\/536\/unit-testing-roadblocks\">\n<p>I&rsquo;m ashamed to admit that this is how many a unit test has been put off. Other laziness incubators include the friction of adding a suitable unit test bundle target to a project, and the difficulty of deciding how to factor your unit tests so that they make sense in the context of your project.<\/p>\n<p>[&#8230;]<\/p>\n<p>But now you&rsquo;re bound to run into a vexing question: &ldquo;how the heck do I debug this thing?&rdquo;. Since unit tests are generally built into a standalone bundle, there&rsquo;s nothing for Xcode to run. But when you come across a failing unit test and you can&rsquo;t figure out why, you find yourself wishing you could step through the code just as you might in an application.<\/p>\n<\/blockquote>\n<p>Jalkut points to various tips for unit testing with Xcode. That&rsquo;s how I originally wrote and ran my unit tests (using <a href=\"http:\/\/www.oops.se\/objcunit\/\">ObjcUnit<\/a>, since Xcode didn&rsquo;t yet have built-in testing support). Now I&rsquo;m taking a different approach: using Python and <a href=\"http:\/\/pyobjc.sourceforge.net\">PyObjC<\/a> to write the tests and <a href=\"http:\/\/codespeak.net\/py\/dist\/test.html\">py.test<\/a> to run them. You may prefer not to deploy an application written in Python or Ruby, but that&rsquo;s no reason not to take advantage of those languages during development. The strengths of dynamic languages are a good fit for writing and debugging unit tests, and the weaknesses don&rsquo;t matter so much in the context of testing.<\/p>","protected":false},"excerpt":{"rendered":"<p>Daniel Jalkut: I&rsquo;m ashamed to admit that this is how many a unit test has been put off. Other laziness incubators include the friction of adding a suitable unit test bundle target to a project, and the difficulty of deciding how to factor your unit tests so that they make sense in the context of [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"2024-07-17T15:21:31Z","apple_news_api_id":"4ce5fba2-32bb-4e88-83c2-6c4aa22e4f3d","apple_news_api_modified_at":"2024-07-17T15:21:31Z","apple_news_api_revision":"AAAAAAAAAAD\/\/\/\/\/\/\/\/\/\/w==","apple_news_api_share_url":"https:\/\/apple.news\/ATOX7ojK7ToiDwmxKoi5PPQ","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":[56,54,71,635,232,268],"class_list":["post-1765","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-debugging","tag-objective-c","tag-programming","tag-pyobjc","tag-python","tag-testing"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/1765","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=1765"}],"version-history":[{"count":1,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/1765\/revisions"}],"predecessor-version":[{"id":44112,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/1765\/revisions\/44112"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=1765"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=1765"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=1765"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}