<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"><channel><title>mikeash.com pyblog/friday-qa-2011-07-22-writing-unit-tests.html comments</title><link>http://www.mikeash.com/?page=pyblog/friday-qa-2011-07-22-writing-unit-tests.html#comments</link><description>mikeash.com Recent Comments</description><lastBuildDate>Sun, 10 May 2026 05:26:55 GMT</lastBuildDate><generator>PyRSS2Gen-1.0.0</generator><docs>http://blogs.law.harvard.edu/tech/rss</docs><item><title>jianhua - 2012-04-25 10:22:23</title><link>http://www.mikeash.com/?page=pyblog/friday-qa-2011-07-22-writing-unit-tests.html#comments</link><description>while(!finished &amp;amp;&amp;amp; [[NSProcessInfo processInfo] systemUptime] - start &amp;lt;= 10)
&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;; // do nothing
&lt;br /&gt;
&lt;br /&gt;---&amp;gt; It will block main thread execution, not work for some cases. 
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;while(!block() &amp;amp;&amp;amp; [[NSProcessInfo processInfo] systemUptime] - start &amp;lt;= 10)
&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;[[NSRunLoop currentRunLoop] runMode: NSDefaultRunLoopMode beforeDate: [NSDate date]];
&lt;br /&gt;
&lt;br /&gt;---&amp;gt; It is none blocking. 
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</description><guid isPermaLink="true">8e86b6c5f7ba58b0fb4e1c136157fe76</guid><pubDate>Wed, 25 Apr 2012 10:22:23 GMT</pubDate></item><item><title>jianhua - 2012-04-25 09:12:29</title><link>http://www.mikeash.com/?page=pyblog/friday-qa-2011-07-22-writing-unit-tests.html#comments</link><description>Hey Anonymous;
&lt;br /&gt;
&lt;br /&gt;How do you think using OCMock to solve dispatch_async delay execution issue? Could you help to explain more? Thank you. 
&lt;br /&gt;
&lt;br /&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; In Ruby, mock dependencies are super easy to create (hence why the method "mock" is so useful in RSpec) and it's also possible, albeit slightly less convenient, in ObjC, using frameworks like OCMock.</description><guid isPermaLink="true">dcb412383b18d5d3797dcdb5568418df</guid><pubDate>Wed, 25 Apr 2012 09:12:29 GMT</pubDate></item><item><title>Justin DeWind - 2011-08-02 17:25:03</title><link>http://www.mikeash.com/?page=pyblog/friday-qa-2011-07-22-writing-unit-tests.html#comments</link><description>There are any number of options for unit testing in Objective-C. 
&lt;br /&gt;
&lt;br /&gt;I like,
&lt;br /&gt;
&lt;br /&gt;[1] Kiwi: BDD framework similar to RSpec, &lt;a href="http://www.kiwi-lib.info/"&gt;http://www.kiwi-lib.info/&lt;/a&gt;
&lt;br /&gt;[2] Frank: Automated functional testing, &lt;a href="http://github.com/moredip/Frank"&gt;http://github.com/moredip/Frank&lt;/a&gt;
&lt;br /&gt;[3] OCHamcrest: Invaluable matcher library
&lt;br /&gt;
&lt;br /&gt;I've also used Cedar but have transitioned to Kiwi.</description><guid isPermaLink="true">1189125455f8a2707758d4ef89418b88</guid><pubDate>Tue, 02 Aug 2011 17:25:03 GMT</pubDate></item><item><title>Stew Gleadow - 2011-07-30 05:23:54</title><link>http://www.mikeash.com/?page=pyblog/friday-qa-2011-07-22-writing-unit-tests.html#comments</link><description>I would also recommend Frank for automated functional testing. github.com/moredip/Frank
&lt;br /&gt;
&lt;br /&gt;If you're from a Ruby background, Frank feels pretty natural because it uses Cucumber and Ruby to talk to your app over HTTP. Running cucumber from a CI build is pretty straightforward too</description><guid isPermaLink="true">ab74f58bfcb1ab120e339b112e12ef3b</guid><pubDate>Sat, 30 Jul 2011 05:23:54 GMT</pubDate></item><item><title>Anonymous - 2011-07-25 00:15:02</title><link>http://www.mikeash.com/?page=pyblog/friday-qa-2011-07-22-writing-unit-tests.html#comments</link><description>There's an interesting RSpec-like framework for ObjC called OCDSpec at &lt;a href="https://github.com/paytonrules/OCDSpec/"&gt;https://github.com/paytonrules/OCDSpec/&lt;/a&gt;
&lt;br /&gt;
&lt;br /&gt;Also, I found this statistic interesting: "FitNesse: Over 2200 unit tests run in 90 sec.  Over 200 integration tests run in &amp;lt; 1 min.  Build/Test/Deploy &amp;lt; 3 min." -- &lt;a href="https://twitter.com/unclebobmartin/status/86521101974376448"&gt;https://twitter.com/unclebobmartin/status/86521101974376448&lt;/a&gt;
&lt;br /&gt;
&lt;br /&gt;A lot of this benefit comes from having mock-dependencies when the real dependency is either impossible, expensive, or impractical to use in testing.
&lt;br /&gt;
&lt;br /&gt;In Ruby, mock dependencies are super easy to create (hence why the method "mock" is so useful in RSpec) and it's also possible, albeit slightly less convenient, in ObjC, using frameworks like OCMock.</description><guid isPermaLink="true">043b6e25ecee635ba6d4474cc0dd83f2</guid><pubDate>Mon, 25 Jul 2011 00:15:02 GMT</pubDate></item><item><title>Stan - 2011-07-24 10:54:00</title><link>http://www.mikeash.com/?page=pyblog/friday-qa-2011-07-22-writing-unit-tests.html#comments</link><description>Nice article! Thumbs up!
&lt;br /&gt;
&lt;br /&gt;Here it is one good example for integration testing - &lt;a href="http://corner.squareup.com/2011/07/ios-integration-testing.html"&gt;http://corner.squareup.com/2011/07/ios-integration-testing.html&lt;/a&gt; . The guys from squareup have released KIF - “Keep It Functional” framework.</description><guid isPermaLink="true">2793620ba3b57a956f50b0ebebe47e13</guid><pubDate>Sun, 24 Jul 2011 10:54:00 GMT</pubDate></item><item><title>Nikita Zhuk - 2011-07-23 16:40:08</title><link>http://www.mikeash.com/?page=pyblog/friday-qa-2011-07-22-writing-unit-tests.html#comments</link><description>Eimantas: For functional testing through UI, there are (at least) couple of options:
&lt;br /&gt;
&lt;br /&gt;- Apple's own UI Automation [1, 2]. You write your tests in JavaScript and execute them via Instruments. As far as I know, there isn't a straightforward way to actually automate running these tests on CLI.
&lt;br /&gt;- KiF [3] A "Keep it Functional" framework from Square. You write your functional tests in ObjC and run them from inside your application process. Can be easily automated and run from CLI. Can even record a video and/or take screenshots of your app while it's being tested or failing. Currently iOS-only, but OS X port is underway.
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;Any others?
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;[1] &lt;a href="http://developer.apple.com/library/ios/#documentation/DeveloperTools/Reference/UIAutomationRef/_index.html"&gt;http://developer.apple.com/library/ios/#documentation/DeveloperTools/Reference/UIAutomationRef/_index.html&lt;/a&gt;
&lt;br /&gt;[2] &lt;a href="http://alexvollmer.com/posts/2010/07/03/working-with-uiautomation/"&gt;http://alexvollmer.com/posts/2010/07/03/working-with-uiautomation/&lt;/a&gt;
&lt;br /&gt;[3] &lt;a href="https://github.com/square/KIF#readme"&gt;https://github.com/square/KIF#readme&lt;/a&gt;</description><guid isPermaLink="true">3688d83174efef383787d2448766669c</guid><pubDate>Sat, 23 Jul 2011 16:40:08 GMT</pubDate></item><item><title>Eimantas - 2011-07-22 17:32:00</title><link>http://www.mikeash.com/?page=pyblog/friday-qa-2011-07-22-writing-unit-tests.html#comments</link><description>Regarding the unit testing - coming from BDD/Ruby&amp;amp;Rails background - the unit tests cover only the M part of the MVC design pattern. I actually miss testing of V &amp;amp; C parts. What are possible functional testing facilities? Are there any solutions for automated UI testing (the V part)? And let's not forget the continuous integration! Any thoughts on the topics above?
&lt;br /&gt;
&lt;br /&gt;Best regards</description><guid isPermaLink="true">1e70202c5ec8962913e6ffa56c230b65</guid><pubDate>Fri, 22 Jul 2011 17:32:00 GMT</pubDate></item></channel></rss>
