<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-4007245636117602802</id><updated>2011-09-01T08:22:35.583-07:00</updated><title type='text'>Cheezy Rants</title><subtitle type='html'>The place where Cheezy rants.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://cheezyrants.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4007245636117602802/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://cheezyrants.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Jeff Morgan</name><uri>http://www.blogger.com/profile/01092053330787982041</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/_qbWhAdH5Tnc/SeIdqU-LMKI/AAAAAAAAABw/o7Vv_gPnnoY/S220/Photo+14.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>5</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-4007245636117602802.post-1640308606436886000</id><published>2010-09-23T04:54:00.001-07:00</published><updated>2010-09-23T04:54:42.412-07:00</updated><title type='text'>New Blog</title><content type='html'>My blog has moved.  You can find my new blog at:&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://www.cheezyworld.com"&gt;http://www.cheezyworld.com&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4007245636117602802-1640308606436886000?l=cheezyrants.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cheezyrants.blogspot.com/feeds/1640308606436886000/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cheezyrants.blogspot.com/2010/09/new-blog.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4007245636117602802/posts/default/1640308606436886000'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4007245636117602802/posts/default/1640308606436886000'/><link rel='alternate' type='text/html' href='http://cheezyrants.blogspot.com/2010/09/new-blog.html' title='New Blog'/><author><name>Jeff Morgan</name><uri>http://www.blogger.com/profile/01092053330787982041</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/_qbWhAdH5Tnc/SeIdqU-LMKI/AAAAAAAAABw/o7Vv_gPnnoY/S220/Photo+14.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4007245636117602802.post-1420841194622756165</id><published>2010-01-16T11:38:00.000-08:00</published><updated>2010-01-16T12:34:50.434-08:00</updated><title type='text'>BDD for the iPhone</title><content type='html'>At Codemash this year several of my friends were exposed to iPhone development for the first time.  I thought this would be a good time for me to share my experience driving iPhone application development with tests.  This entry will walk you through getting xcode setup and your project linking against all of the libraries you will need to write effective tests.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;With each new xcode release Apple has steadily improved support for Unit Testing.  This is a good thing but it also means that the setup I will explain here is only guaranteed to work in xcode version 3.2.1.  If you are using an order version you will likely need to make a few tweeks to the instructions below in order to get it working.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style=" font-weight: bold; font-size:24px;"&gt;Adding Unit Test Support&lt;/span&gt;&lt;br /&gt;The first thing we have to do after creating the empty project is add support for testing.  The first step is to add a new build target.&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Right click on the &lt;i&gt;Targets&lt;/i&gt; folder and select &lt;i&gt;Add -&gt; New Target&lt;/i&gt;.&lt;/li&gt;&lt;li&gt; Select &lt;i&gt;Unit Test Bundle&lt;/i&gt; for &lt;i&gt;Cocoa Touch&lt;/i&gt;.&lt;/li&gt;&lt;li&gt;I like to name this target &lt;i&gt;Specs&lt;/i&gt;.&lt;/li&gt;&lt;li&gt; This will bring up the &lt;i&gt;Target&lt;/i&gt; Info dialog but you can just close it for now.&lt;/li&gt;&lt;/ol&gt;The next step is the add the SenTestFramework to our project.  This is the xUnit library for Objective-C.&lt;br /&gt;&lt;ol&gt;&lt;li&gt; Right click on the &lt;i&gt;Frameworks&lt;/i&gt; folder and select &lt;i&gt;Add -&gt; Existing Frameworks...&lt;/i&gt;&lt;/li&gt;&lt;li&gt; Select the &lt;i&gt;Add Other...&lt;/i&gt; button at the bottom of the dialog.&lt;/li&gt;&lt;li&gt; You should select the &lt;i&gt;SenTestingKit.framework&lt;i&gt; directory found under the &lt;i&gt;/Developer/Library/Frameworks&lt;/i&gt; directory.&lt;/i&gt;&lt;/i&gt;&lt;/li&gt;&lt;/ol&gt;&lt;i&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-style: normal;"&gt;Next we will need to create a folder to hold our test classes.  You do this by right clicking on the project name above the &lt;i&gt;Classes&lt;/i&gt; folder and select &lt;i&gt;Add -&gt; New Group&lt;/i&gt;.  I also like to name this group &lt;/span&gt;Specs&lt;span class="Apple-style-span" style="font-style: normal;"&gt;.  And finally we need to temporarily change our build target to build our test target.  You can do this by selecting the drop down box in the upper left corner of xcode and selecting our &lt;/span&gt;Specs&lt;span class="Apple-style-span" style="font-style: normal;"&gt; target.&lt;/span&gt;&lt;/i&gt;&lt;/i&gt;&lt;div&gt;&lt;i&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-style: normal;"&gt;&lt;/span&gt;&lt;/i&gt;&lt;/i&gt;&lt;br /&gt;&lt;div&gt;&lt;div&gt;With these steps out of the way we are finally ready to create our first test class.  Right click on our Specs group and select &lt;i&gt;Add -&gt; New File&lt;/i&gt;.  Select &lt;i&gt;Objective-C test case class&lt;/i&gt; under &lt;i&gt;Cocoa Touch Class&lt;/i&gt;.  Let’s name this first class &lt;i&gt;SimpleSpec&lt;/i&gt;.  Make sure you only add this class to our &lt;span class="Apple-style-span" style="font-style: italic; "&gt;Sp&lt;span class="Apple-style-span" style="font-style: normal; "&gt;&lt;i&gt;ec&lt;/i&gt; target.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 181px;" src="http://1.bp.blogspot.com/_qbWhAdH5Tnc/S1IZG8XdYZI/AAAAAAAAAC8/20-CHKFLyKw/s400/NewTestCase.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5427428108009300370" /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;There is no need to have a separate header and implementation file for our unit tests so I combine them in order to keep things as simple as possible.  Select all of the code (including the import statements) from the header file and copy them to the top of the implementation file.  Also, remove all of the example tests that were included by default.  You can now delete the header file.  In a later blog post I will show you how to change the template so it generates the test &lt;span class="Apple-style-span"  style="font-size:medium;"&gt;c&lt;/span&gt;lasses without these examples and in the same file.  When you are finished you implementation file should look like:&lt;div&gt;&lt;br /&gt;&lt;div&gt;&lt;p  style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color:#e00000;"&gt;&lt;span style="letter-spacing: 0.0px ;color:#7e4623;"&gt;#import &lt;/span&gt;&lt;span style="letter-spacing: 0.0px "&gt;&lt;span class="Apple-style-span"  style="color:#CC0000;"&gt;&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;sentestingkit/sentestingkit.h&gt;&lt;span class="Apple-style-span" style="color: rgb(224, 0, 0); "&gt;SenTestingKit/SenTestingKit.h&amp;gt;&lt;/span&gt;&lt;/sentestingkit/sentestingkit.h&gt;&lt;/span&gt;&lt;/p&gt; &lt;p  style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color:#e00000;"&gt;&lt;span style="letter-spacing: 0.0px ;color:#7e4623;"&gt;#import &lt;/span&gt;&lt;span style="letter-spacing: 0.0px "&gt;&lt;span class="Apple-style-span"  style="color:#CC0000;"&gt;&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;uikit/uikit.h&gt;&lt;span class="Apple-style-span" style="color: rgb(224, 0, 0); "&gt;UIKit/UIKit.h&amp;gt;&lt;/span&gt;&lt;/uikit/uikit.h&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px"&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;/span&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px"&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;/span&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"&gt;&lt;span style="letter-spacing: 0.0px ;color:#c800a3;"&gt;@interface&lt;/span&gt;&lt;span style="letter-spacing: 0.0px"&gt; SimpleSpec : SenTestCase {&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"&gt;&lt;span style="letter-spacing: 0.0px"&gt;}&lt;/span&gt;&lt;/p&gt; &lt;p  style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color:#c800a3;"&gt;&lt;span style="letter-spacing: 0.0px"&gt;@end&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px"&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;/span&gt;&lt;br /&gt;&lt;/p&gt; &lt;p  style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color:#c800a3;"&gt;&lt;span style="letter-spacing: 0.0px"&gt;@implementation&lt;/span&gt;&lt;span style="letter-spacing: 0.0px ;color:#000000;"&gt; SimpleSpec&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px"&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;/span&gt;&lt;br /&gt;&lt;/p&gt; &lt;p  style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color:#c800a3;"&gt;&lt;span style="letter-spacing: 0.0px"&gt;@end&lt;/span&gt;&lt;/p&gt;&lt;/div&gt;&lt;div&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"&gt;&lt;span class="Apple-style-span" style="font-size: medium; "&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;We are now ready to write our first test method.  Add the following method to your implementation:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"&gt;&lt;span style="letter-spacing: 0.0px"&gt;- (&lt;/span&gt;&lt;span class="Apple-style-span"  style="color:#CC33CC;"&gt;void&lt;/span&gt;&lt;span style="letter-spacing: 0.0px"&gt;) testShouldExecuteTest {&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"&gt;&lt;span class="Apple-style-span"  style="color:#666600;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="color:#000000;"&gt; &lt;/span&gt;&lt;/span&gt;STAssertTrue&lt;/span&gt;&lt;span style="letter-spacing: 0.0px"&gt;(&lt;/span&gt;&lt;span class="Apple-style-span"  style="color:#3366FF;"&gt;1&lt;/span&gt;&lt;span style="letter-spacing: 0.0px"&gt; + &lt;/span&gt;&lt;span class="Apple-style-span"  style="color:#3333FF;"&gt;1&lt;/span&gt;&lt;span style="letter-spacing: 0.0px"&gt; == &lt;/span&gt;&lt;span class="Apple-style-span"  style="color:#3333FF;"&gt;2&lt;/span&gt;&lt;span style="letter-spacing: 0.0px"&gt;, &lt;/span&gt;&lt;span class="Apple-style-span"  style="color:#CC33CC;"&gt;nil&lt;/span&gt;&lt;span style="letter-spacing: 0.0px"&gt; );&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"&gt;&lt;span style="letter-spacing: 0.0px"&gt;}&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"&gt;&lt;br /&gt;&lt;/p&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="font-family:Helvetica, serif;font-size:100%;"&gt;&lt;span class="Apple-style-span"  style="font-size:12px;"&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Build the project by executing ⌘B.  You will get very familiar with this key sequence.  I think of this as my “run unit tests” key combination.  If everything is setup correctly you should see Succeeded in the bottom right corner of the window.  Let’s bring up the build result window by pressing &lt;/span&gt;&lt;/span&gt;&lt;span style="font: 12.0px 'Apple Symbols'; letter-spacing: 0.0px"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;⍐&lt;/span&gt;&lt;/span&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;⌘B.  I usually keep this window open at all times as it gives me clearer feedback on the status of my builds.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;div&gt;&lt;img src="webkit-fake-url://91FC6DEB-7F1B-4C80-92C6-A3310D235EBC/image.tiff" /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;To make absolutely sure you have everything setup correctly change the 2 to 3 in our tests and build again.  You should see a failure this time.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;img src="webkit-fake-url://034D3D4C-7368-459F-963C-CFD47E1951CD/image.tiff" /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Congratulations.  Change the code back and you should see the build complete successfully.  We have working Unit Tests but there is still one task remaining before we can move on.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;As we develop our application we should not be building the &lt;/span&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Spec&lt;/span&gt;&lt;/i&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; target.  Instead we should be building our application target and have the &lt;/span&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Spec&lt;/span&gt;&lt;/i&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; target build as a dependency.  Luckily this is very easy to do.  Right click on the application target and select &lt;/span&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Get Info&lt;/span&gt;&lt;/i&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;.  Make sure you are on the &lt;/span&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;General&lt;/span&gt;&lt;/i&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; tab and select the plus (+) button under &lt;/span&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Direct Dependencies&lt;/span&gt;&lt;/i&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;.  Add the &lt;/span&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Specs&lt;/span&gt;&lt;/i&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; target and close the dialog.  Change the build target to your application target and build again.  If everything is setup correctly this build should succeed.  Next change the tests so it will fail and build again.  If it does fail you are ready to fix the test and move on.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:x-large;"&gt;Hamcrest&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:x-large;"&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;I have always felt that the &lt;/span&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;SenTest&lt;/span&gt;&lt;/i&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; API negatively effected the expressiveness of my tests so I was very happy to learn that &lt;/span&gt;&lt;a href="http://code.google.com/p/hamcrest/"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Hamcrest&lt;/span&gt;&lt;/a&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; was ported to Objective-C.  I highly recommend you use this framework for all of your Objective-C testing.  The library is not available as a binary so you will have to build it yourself.  Check out the source from svn -&gt; &lt;/span&gt;&lt;a href="http://code.google.com/p/hamcrest/source/checkout"&gt;&lt;span style="text-decoration: underline ; letter-spacing: 0.0px color:#0b00ae;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;http://code.google.com/p/hamcrest/source/checkout&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;.  Once the source is checked out open the &lt;/span&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;OCHamcrest.xcodeproj&lt;/span&gt;&lt;/i&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; project file located in the &lt;/span&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;hamcrest-objectivec/Source&lt;/span&gt;&lt;/i&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; directory and build a Release version of the project.  This will compile the project and create an &lt;/span&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;OCHamcrest.framework&lt;/span&gt;&lt;/i&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; directory in the &lt;/span&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;hamcrest-objectivec/Source/build/Release&lt;/span&gt;&lt;/i&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; directory.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;The next step is to create a &lt;/span&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Frameworks&lt;/span&gt;&lt;/i&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; directory in the root of your project.  This should be a physical directory and not a virtual folder created via xcode.  Copy the &lt;/span&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;OCHamcrest.framework&lt;/span&gt;&lt;/i&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; directory to your newly created &lt;/span&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Frameworks&lt;/span&gt;&lt;/i&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; directory.  Once this is complete add it to the project as a Framework the same way you added &lt;/span&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;SenTestingKit.framework&lt;/span&gt;&lt;/i&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; above.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"&gt;&lt;/p&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Now we need to modify our &lt;/span&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Specs&lt;/span&gt;&lt;/i&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; target to include Hamcrest.  Right click o&lt;/span&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;n your &lt;/span&gt;&lt;/span&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Spec&lt;/span&gt;&lt;/i&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; target and select &lt;/span&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Add -&gt; New Build Phase -&gt; New&lt;/span&gt;&lt;span class="Apple-style-span" style="font-style: normal;  "&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; Copy Files Build Phase&lt;/span&gt;&lt;/i&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;.  Select &lt;/span&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Products Directory&lt;/span&gt;&lt;/i&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; for the Destination and close the dialog.  Drag the new build step to&lt;/span&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; the top the of the build chain.  Next select the &lt;/span&gt;&lt;/span&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;OCHamcrest.framework&lt;/span&gt;&lt;/i&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; from the Frameworks folder and drag it to the &lt;/span&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Copy Files &lt;/span&gt;&lt;/i&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;build step.  Also drag the framework to the &lt;/span&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Link Binary With Libraries&lt;/span&gt;&lt;/i&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; build step.  Your &lt;/span&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Spec&lt;/span&gt;&lt;/i&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; target should look like&lt;/span&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; this:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;img src="webkit-fake-url://3D9BC00E-7E3B-4D2E-BC0E-DF011D69E461/image.tiff" /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"&gt;&lt;/p&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Now we can try to write a new test using Hamcrest.  In your &lt;/span&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;SimpleSpec&lt;/span&gt;&lt;/i&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; test class write the following test method:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;span class="Apple-style-span"  style="font-family:Menlo, serif;"&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;- (&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="color:#993399;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;void&lt;/span&gt;&lt;/span&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;) testShouldUseHamcrest {&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;span class="Apple-style-span"  style="font-family:Menlo, serif;"&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;assertThat(&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="color:#CC0000;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;@"Apple"&lt;/span&gt;&lt;/span&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;, is(&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="color:#CC0000;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;@"Apple"&lt;/span&gt;&lt;/span&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;));&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;span class="Apple-style-span"  style="font-family:Menlo, serif;"&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;assertThat(&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="color:#CC0000;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;@"Apple"&lt;/span&gt;&lt;/span&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;, isNot(&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="color:#CC0000;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;@"Google"&lt;/span&gt;&lt;/span&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;));&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;span class="Apple-style-span"  style="font-family:Menlo, serif;"&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;span class="Apple-style-span" style="color: rgb(224, 0, 0); "&gt;&lt;span style="letter-spacing: 0.0px ;color:#000000;"&gt;&lt;span class="Apple-style-span"  style="color:#000000;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="color:#E00000;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;assertThat&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="color:#000000;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;@"Cheezy loves his iPhone"&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="color:#000000;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;, containsString(&lt;/span&gt;&lt;/span&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;@"Cheezy"&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="color:#000000;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;));&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;span class="Apple-style-span"  style="font-family:Menlo, serif;"&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;span class="Apple-style-span" style="color: rgb(224, 0, 0); "&gt;&lt;span class="Apple-style-span"  style="color:#000000;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"&gt;&lt;/p&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:Menlo, serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:Menlo, serif;"&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;You will also need to add the following at the top of the file after the existing import statements:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="font-family:Helvetica, serif;font-size:100%;"&gt;&lt;span class="Apple-style-span" style="font-size: 12px;"&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #7e4623"&gt;&lt;span style="letter-spacing: 0.0px"&gt;#define HC_SHORTHAND&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #e00000"&gt;&lt;span class="Apple-style-span"  style="color:#666600;"&gt;#import&lt;/span&gt;&lt;span class="Apple-style-span"  style="color:#333300;"&gt; &lt;/span&gt;&lt;span style="letter-spacing: 0.0px"&gt;&amp;lt;OCHamcrest/OCHamcrest.h&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;&lt;div&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Build your project.  If everything is setup correctly you should see success.  I suggest you read the tutorial as it has everything you need to get started using Hamcrest.  You can find it &lt;a href="http://code.google.com/p/hamcrest/wiki/TutorialObjectiveC"&gt;here&lt;/a&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: x-large;"&gt;OCMock&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;As you develop your iPhone application you will constantly have the need to mock and stub the UI framework classes.  The framework for this is &lt;a href="http://www.mulle-kybernetik.com/software/OCMock/"&gt;OCMock&lt;/a&gt;.&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;  The way you get it into your project is by following the same steps you used for Hamcrest.  Copy the &lt;/span&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;OCMock.framework&lt;/span&gt;&lt;/i&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; folder to your &lt;/span&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Frameworks&lt;/span&gt;&lt;/i&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; directory under your project and add it to the &lt;/span&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Frameworks&lt;/span&gt;&lt;/i&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; virtual folder in the project.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Drag the &lt;/span&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;OCMock.framework&lt;/span&gt;&lt;/i&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; framework down to the &lt;/span&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Copy Files&lt;/span&gt;&lt;/i&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; build step as well as the &lt;/span&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Link Binary With Libraries&lt;/span&gt;&lt;/i&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; build step.  We are now ready to try to write our first test using mocks.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;In the &lt;/span&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;SimpleSpec&lt;/span&gt;&lt;/i&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; test class write the following method:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;&lt;span class="Apple-style-span" style="font-size: 12px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;&lt;span class="Apple-style-span" style="font-size: 12px;"&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;- (&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="color:#993399;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;void&lt;/span&gt;&lt;/span&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;) testShouldUseOCMock {&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"&gt;&lt;span class="Apple-style-span"  style="color:#993399;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="color:#000000;"&gt; &lt;/span&gt;&lt;/span&gt;id&lt;/span&gt;&lt;/span&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt; mockString = [&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;span class="Apple-style-span"  style="color:#6600CC;"&gt;OCMockObject&lt;/span&gt;&lt;/span&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;mockForClass&lt;/span&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;:[&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;span class="Apple-style-span"  style="color:#6600CC;"&gt;NSString&lt;/span&gt;&lt;/span&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;class&lt;/span&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;]];&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #430084"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;[&lt;span class="Apple-style-span"  style="color:#000000;"&gt;[[mockString &lt;/span&gt;&lt;/span&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;span class="Apple-style-span"  style="color:#000000;"&gt;stub&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;span class="Apple-style-span"  style="color:#000000;"&gt;] &lt;/span&gt;&lt;/span&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;span class="Apple-style-span"  style="color:#000000;"&gt;andReturn&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;:&lt;span class="Apple-style-span"  style="color:#CC0000;"&gt;@"cheezy"&lt;/span&gt;] &lt;/span&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;lowercaseString&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;];&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;span class="Apple-style-span"  style="color:#666600;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="color:#000000;"&gt; &lt;/span&gt;&lt;/span&gt;assertThat&lt;/span&gt;&lt;/span&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;([mockString &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;lowercaseString&lt;/span&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;], &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;is&lt;/span&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;equalTo&lt;/span&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;span class="Apple-style-span"  style="color:#CC0000;"&gt;@"cheezy"&lt;/span&gt;&lt;/span&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;)));&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="font-family:Menlo, serif;font-size:100%;"&gt;&lt;span class="Apple-style-span" style="font-size: 11px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;&lt;span class="Apple-style-span" style="font-size: 12px; "&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px"&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;and add the following import statement:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px"&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;/span&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #e00000"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;span class="Apple-style-span"  style="color:#666600;"&gt;#import&lt;/span&gt; &lt;/span&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&amp;lt;OCMock/OCMock.&lt;/span&gt;h&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px"&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;That is all there is to it.  You can find several tutorials on the OCMock page.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"&gt;&lt;span class="Apple-style-span" style="font-size: x-large;"&gt;Finishing Touches&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;There still are several simple things we can do to make our tests more expressive.  First of all I do not like the assert syntax.  I much prefer the language of bdd.  The good news is that this is very simple to change.  Add the following to the top of your &lt;/span&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;SimpleSpec&lt;/span&gt;&lt;/i&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; class:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px"&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;/span&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #7e4623"&gt;&lt;span style="letter-spacing: 0.0px"&gt;#define ensureThat assertThat&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px"&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;/span&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Now we can change our verification to:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px"&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;/span&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"&gt;&lt;span style="letter-spacing: 0.0px"&gt;  ensureThat(&lt;/span&gt;&lt;span class="Apple-style-span"  style="color:#CC0000;"&gt;@"Apple"&lt;/span&gt;&lt;span style="letter-spacing: 0.0px"&gt;, is(&lt;/span&gt;&lt;span class="Apple-style-span"  style="color:#CC0000;"&gt;@"Apple"&lt;/span&gt;&lt;span style="letter-spacing: 0.0px"&gt;));&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px"&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;/span&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Also we now have a lot of statements at the beginning of our test class.  I move all of them into a single header file and just include it in each file.  The contents of that file are:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px"&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;/span&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #7e4623"&gt;&lt;span style="letter-spacing: 0.0px"&gt;#define HC_SHORTHAND&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #e00000"&gt;&lt;span class="Apple-style-span"  style="color:#666600;"&gt;#import&lt;/span&gt;&lt;span style="letter-spacing: 0.0px color: #7e4623"&gt; &amp;lt;&lt;/span&gt;&lt;span style="letter-spacing: 0.0px"&gt;OCHamcrest/OCHamcrest.h&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #e00000"&gt;&lt;span class="Apple-style-span"  style="color:#666600;"&gt;#import &lt;/span&gt;&lt;span style="letter-spacing: 0.0px"&gt;&amp;lt;OCMock/OCMock.h&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px"&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;/span&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #7e4623"&gt;&lt;span style="letter-spacing: 0.0px"&gt;#define ensureThat assertThat&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #7e4623; min-height: 13.0px"&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;/span&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Finally I am working on a change that will allow me to name my test methods more in line with the rspec approach.  A test method could be named &lt;/span&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;itShouldDoSomething&lt;/span&gt;&lt;/i&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; instead of &lt;/span&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;testShouldDoSomething&lt;/span&gt;&lt;/i&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;.  Stay tuned for further updates on this change.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"&gt;&lt;span style="letter-spacing: 0.0px"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;I hope you found this entry helpful.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;&lt;span class="Apple-style-span" style="font-size: 12px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4007245636117602802-1420841194622756165?l=cheezyrants.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cheezyrants.blogspot.com/feeds/1420841194622756165/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cheezyrants.blogspot.com/2010/01/bdd-for-iphone.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4007245636117602802/posts/default/1420841194622756165'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4007245636117602802/posts/default/1420841194622756165'/><link rel='alternate' type='text/html' href='http://cheezyrants.blogspot.com/2010/01/bdd-for-iphone.html' title='BDD for the iPhone'/><author><name>Jeff Morgan</name><uri>http://www.blogger.com/profile/01092053330787982041</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/_qbWhAdH5Tnc/SeIdqU-LMKI/AAAAAAAAABw/o7Vv_gPnnoY/S220/Photo+14.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_qbWhAdH5Tnc/S1IZG8XdYZI/AAAAAAAAAC8/20-CHKFLyKw/s72-c/NewTestCase.png' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4007245636117602802.post-7547972688020056164</id><published>2009-07-09T03:59:00.000-07:00</published><updated>2009-07-09T06:03:18.683-07:00</updated><title type='text'>What does taza need?</title><content type='html'>For those of you that haven’t taken a look at it I suggest you spend some time with &lt;a href="http://github.com/scudco/taza/tree/master"&gt;taza&lt;/a&gt;.  Taza is a ruby gem that provides an object oriented wrapper around web sites, pages, and flows.  It provides an abstraction from the details of the pages as well as from the driver (&lt;a href="http://seleniumhq.org/"&gt;selenium&lt;/a&gt; or &lt;a href="http://wtr.rubyforge.org/"&gt;watir&lt;/a&gt;) and target browser.  The gem includes generators to create the shell of the desired classes.  It was built for a specific purpose and serves that purpose well.&lt;br /&gt;&lt;br /&gt;I first heard about taza from Joe O’Brien over breakfast one morning.  He mentioned in passing that he was using it on a project.  Since the gem was related to testing I had to take a look.  At first it didn’t seem to fill a need I was having so I filed it away for later interrogation.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;What do I need?&lt;/b&gt;&lt;br /&gt;The company I work for (&lt;a href="http://leandog.com/"&gt;LeanDog&lt;/a&gt;) builds software and/or coaches companies hoping to learn how to become more agile or lean in there software development practices.  I coach teams that develop software using J2EE  and Ruby on Rails.  It is not infrequent for my customers to have no test automation and often I am called upon to help setup the tools as well as train their developers and testers.  As you might expect, I am very interested in automated testing.&lt;br /&gt;&lt;br /&gt;I have standardized on using &lt;a href="http://wiki.github.com/aslakhellesoy/cucumber"&gt;Cucumber&lt;/a&gt; for “acceptance testing” most web applications (both rails and J2EE) with &lt;a href="http://jbehave.org/"&gt;JBehave&lt;/a&gt; being the exception on Java teams where they refuse to introduce Ruby.  The tool works great for facilitating conversations between the customer and developers.  Throughout numerous projects I have fine tuned my approach to using cucumber trying to maintain a balance between step granularity, good test design, and minimizing the need to refactor tests as the application grows and changes.&lt;br /&gt;&lt;br /&gt;I have used both selenium and watir to drive the browser for our tests.  Each gem has its’ strengths as well as weaknesses.  We have learned over time that it is not a good idea to make calls to either API directly from our steps but rather to build up objects that represent our pages and encapsulate the details of the elements on the page (much like &lt;a href="http://code.google.com/p/webdriver/wiki/PageObjects"&gt;http://code.google.com/p/webdriver/wiki/PageObjects&lt;/a&gt;).  These objects are tedious to write and once written they are bound to a driver (either selenium or watir).&lt;br /&gt;&lt;br /&gt;In order to make things easier for me and my teams I decided I would write a new gem that would help alleviate the tedium of writing the page objects as well as isolate them from the driver.   As I was working out the details of this new project I remembered taza.  Taza has much of what I need but is lacking in a few areas.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Rails Support&lt;/b&gt;&lt;br /&gt;Currently taza generates a stand-alone project from which you create your page objects and tests.  If you plan to test a rails application I believe it would be more appropriate to generate taza directly into the rails application.  This would require the development of a new generator.  This new generator would generate the following:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;br /&gt; &lt;li&gt;A site directory where the taza generated classes would reside&lt;/li&gt;&lt;br /&gt; &lt;li&gt;A taza.yml file in the config directory that would contain what is currently in the config.yml and &lt;site&gt;.yml&lt;/site&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;These items would be generated directly into your rails application structure.  Once taza is generated into your rails application it could be used by both cucumber and rspec tests.  I would expect the classes that are generated inside of your rails application to be exactly the same as what is generated in a stand-alone project.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Element Generation&lt;/b&gt;&lt;br /&gt;When you generate a page in taza you end up with a shell that looks like this:&lt;br /&gt;&lt;pre&gt;module Google&lt;br /&gt;  class HomePage &amp;lt; Taza::Page&lt;br /&gt;&lt;br /&gt;  end&lt;br /&gt;end&lt;/pre&gt;&lt;br /&gt;Next the developer must edit the generated class to add all of the elements from the html page.  The google search page might look like this:&lt;br /&gt;&lt;pre&gt;module Google&lt;br /&gt;  class HomePage &amp;lt; Taza::Page&lt;br /&gt;    element(:search_field) { browser.text_field(:name, 'q') }&lt;br /&gt;    element(:search_button) { borwser.button(:name, 'btnG') }&lt;br /&gt;  end&lt;br /&gt;end&lt;/pre&gt;&lt;br /&gt;I believe there are two problems with this approach.  The first is that the code written is directly coupled to the driver (I address this in more detail in the next section).  The second problem is that all of the additional work a developer must perform setting up the page could be avoided if the generator were enhanced.  I also believe this additional work is a roadblock for adoption.  As a result the general approach today is to use something like &lt;a href="http://github.com/brynary/webrat/tree/master"&gt;webrat&lt;/a&gt; and couple the cucumber steps directly to elements on the page.  Let me try to explain a different approach.&lt;br /&gt;&lt;br /&gt;I would like to see the current taza page generator (and other generators within taza) enhanced to generate the page elements.  Generating the above page would be very much like generating a rails model:&lt;br /&gt;&lt;pre&gt;script/generate page search_field:text_field :search_button:button&lt;/pre&gt;&lt;br /&gt;The result of the above command would result in this class:&lt;br /&gt;&lt;pre&gt;module Google&lt;br /&gt;  class HomePage &amp;lt; Taza::Page&lt;br /&gt;    text_field :search_field&lt;br /&gt;    button :search_button&lt;br /&gt;  end&lt;br /&gt;end&lt;/pre&gt;&lt;br /&gt;For the google search the developer would then have to go in and set the name values like the code in bold below.&lt;br /&gt;&lt;pre&gt;module Google&lt;br /&gt;  class HomePage &amp;lt; Taza::Page&lt;br /&gt;    text_field :search_field, &lt;b&gt;:name =&gt; 'q'&lt;/b&gt;&lt;br /&gt;    button :search_button, &lt;b&gt;:name =&gt; 'btnG'&lt;/b&gt;&lt;br /&gt;  end&lt;br /&gt;end&lt;/pre&gt;&lt;br /&gt;Once the proceeding step was completed I would envision being able to use it in my test like this:&lt;br /&gt;&lt;pre&gt;home_page.search_field = “Ruby”&lt;br /&gt;home_page.press :search_button&lt;/pre&gt;&lt;br /&gt;Please note that I am not proposing the exact usage api here.  This is currently just an idea and as such there are many issues to be fleshed out.  I expect the fleshing to take place during development.&lt;br /&gt;&lt;br /&gt;Imagine a typical rails application where we have a page representing a user model with name, address, city, state, and zipcode.  The page could look like this:&lt;br /&gt;&lt;pre&gt;module MyApp&lt;br /&gt;  class UserPage &amp;lt; Taza::Page&lt;br /&gt;    text_field :name&lt;br /&gt;    text_field :address&lt;br /&gt;    text_field :city&lt;br /&gt;    selection :state&lt;br /&gt;    text_field :zipcode&lt;br /&gt;  end&lt;br /&gt;end&lt;/pre&gt;&lt;br /&gt;In our page class we could attempt to map the elements to items on the page with an id or name of “user_name”, “user_address”, etc.  If we did not find user_name we could look for “name”.  In many cases this would just work without any additional effort on the part of the developer.  This follows the rails approach of convention over configuration.&lt;br /&gt;&lt;br /&gt;Clearly this effort requires more than just changes to the generators.  There would need to be significant changes made to the current taza library which I could see happening as part of the driver isolation effort.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Driver Isolation&lt;/b&gt;&lt;br /&gt;Lets look at the google page object from the previous section:&lt;br /&gt;&lt;pre&gt;module Google&lt;br /&gt;  class HomePage &amp;lt; Taza::Page&lt;br /&gt;    element(:search_field) { &lt;b&gt;browser.text_field(:name, ‘q’)&lt;/b&gt; }&lt;br /&gt;    element(:search_button) { &lt;b&gt;browser.button(:name, ‘btnG’)&lt;/b&gt; }&lt;br /&gt;  end&lt;br /&gt;end&lt;/pre&gt;&lt;br /&gt;Later when this is used it is accessed like this:&lt;br /&gt;&lt;pre&gt;home_page.search_field.&lt;b&gt;set&lt;/b&gt; ‘ruby’&lt;/pre&gt;&lt;br /&gt;All of the code in bold is API from the driver - either selenium or watir.  When you start building your objects with one driver you are stuck with it short of some major refactoring.  It also keeps you from running your tests using both platforms if you so desire.&lt;br /&gt;&lt;br /&gt;I believe taza should isolate the developer from the underlying driver much the same way that ActiveRecord provides isolation from different databases.  This would allow developers to switch between drivers by changing the configuration yml files.  A developer might want to do this if they determine that one driver works better with a specific browser while the other driver works better with yet another.  There also might be cases where a driver adds support for a new browser type/version that is not available in the other.&lt;br /&gt;&lt;br /&gt;The driver isolation would take the form of a thin veneer over both selenium and watir.  The veneer would still allow developers to access the browser directly so they could use  driver specific code where they deem necessary or on APIs that we do not yet provide in our wrapper.  The goal of this effort would be to provide an API/DSL that would give developers the majority of the functionality they need to test web applications.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4007245636117602802-7547972688020056164?l=cheezyrants.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cheezyrants.blogspot.com/feeds/7547972688020056164/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cheezyrants.blogspot.com/2009/07/what-does-taza-need.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4007245636117602802/posts/default/7547972688020056164'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4007245636117602802/posts/default/7547972688020056164'/><link rel='alternate' type='text/html' href='http://cheezyrants.blogspot.com/2009/07/what-does-taza-need.html' title='What does taza need?'/><author><name>Jeff Morgan</name><uri>http://www.blogger.com/profile/01092053330787982041</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/_qbWhAdH5Tnc/SeIdqU-LMKI/AAAAAAAAABw/o7Vv_gPnnoY/S220/Photo+14.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4007245636117602802.post-2021267910097791729</id><published>2009-07-01T04:51:00.000-07:00</published><updated>2009-07-01T04:56:33.756-07:00</updated><title type='text'>Selenium Ruby</title><content type='html'>After using the selenium ruby gem for a while and seeing its' potential I decided to look deeper into the code.  After cloning the project from github I quickly discovered it would not build locally.  I also discovered that there had been no activity on the project for about five months.  This was enough motivation for me to fork the project.  I hope the OD is open to my pull requests but I guess that remains to be seen.  If you want to check it out you can find it on github under cheezy.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4007245636117602802-2021267910097791729?l=cheezyrants.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cheezyrants.blogspot.com/feeds/2021267910097791729/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cheezyrants.blogspot.com/2009/07/selenium-ruby.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4007245636117602802/posts/default/2021267910097791729'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4007245636117602802/posts/default/2021267910097791729'/><link rel='alternate' type='text/html' href='http://cheezyrants.blogspot.com/2009/07/selenium-ruby.html' title='Selenium Ruby'/><author><name>Jeff Morgan</name><uri>http://www.blogger.com/profile/01092053330787982041</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/_qbWhAdH5Tnc/SeIdqU-LMKI/AAAAAAAAABw/o7Vv_gPnnoY/S220/Photo+14.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4007245636117602802.post-232212344685064269</id><published>2009-04-12T08:54:00.000-07:00</published><updated>2009-04-12T09:44:31.626-07:00</updated><title type='text'>Getting Started with Groovy</title><content type='html'>After putting it off for a long while I decided it was finally time for me to learn Groovy.  &lt;a href="http://www.juddsolutions.com/"&gt;Chris Judd&lt;/a&gt; gave me a copy of his book &lt;a href="http://www.beginninggroovyandgrails.com/site/content/index"&gt;Beginning Groovy and Grails&lt;/a&gt; when I saw him at &lt;a href="http://coderetreat.ning.com/"&gt;Code Retreat 2&lt;/a&gt; here in Cleveland on the &lt;a href="http://leandogsoftware.com/blog/?page_id=419"&gt;boat&lt;/a&gt;.  The fact that I will probably see him and &lt;a href="http://jshingler.blogspot.com/"&gt;Jim Shingler&lt;/a&gt; (a co-author for the book) at the &lt;a href="http://www.cojug.org/"&gt;CoJUG&lt;/a&gt; when I am in Columbus this Tuesday was enough motivation to get me rolling.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;First of all I need to setup a development environment.  Let me see... what are my choices?&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;IntelliJ - very nice but I don't own a copy and re-installing the evaluation over and over again is not fun.&lt;/li&gt;&lt;li&gt;Eclipse - it is free but the editor really sucks.&lt;/li&gt;&lt;li&gt;TextMate - it has nice Groovy and Grails support but I am not real familiar with it.&lt;/li&gt;&lt;li&gt;Emacs - my favorite editor of all time but I'll need to add Groovy support.  I think I'll start here.&lt;/li&gt;&lt;/ul&gt;I was able to find an emacs &lt;a href="http://groovy.codehaus.org/Emacs+Plugin"&gt;groovy mode&lt;/a&gt; at the groovy site.  I chose to use &lt;a href="http://svn.groovy.codehaus.org/browse/~raw,r=HEAD/groovy/trunk/groovy/ide/groovy-emacs/groovy-mode.el"&gt;Jeremy's&lt;/a&gt; version and added it to my emacs config&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 60px;" src="http://3.bp.blogspot.com/_qbWhAdH5Tnc/SeIXeAFSXpI/AAAAAAAAABg/9LIX2aiXYVs/s400/add_grovy_mode.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5323843513691037330" /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;This mode provided basic language indentation and highlighting but not much else.  I guess I will be enhancing it over the coming months.  In order to pimp up my emacs for Groovy development I really needed to add a collection of &lt;a href="http://code.google.com/p/yasnippet/"&gt;yasnippets&lt;/a&gt;.  I modified my yasnippet.el making it aware of my new groovy-mode and proceeded to add 62 snippets covering basic Groovy and Grails functionality.  You can find all of this and my complete emacs configuration at my github &lt;a href="http://github.com/cheezy/emacs.d/tree/master"&gt;emacs.d project&lt;/a&gt;.  Now that I finally had a powerful development it was time to move on to the language.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Since I already have a lot of experience with Ruby and Java I thought it would be easy to pick up Groovy.  My initial impression is that there are several things that feel weird - I guess I was expecting it to be more like ruby.  I know I will have a lot to say about this over the coming weeks so please stay tuned.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4007245636117602802-232212344685064269?l=cheezyrants.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cheezyrants.blogspot.com/feeds/232212344685064269/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cheezyrants.blogspot.com/2009/04/after-putting-it-off-for-long-while-i.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4007245636117602802/posts/default/232212344685064269'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4007245636117602802/posts/default/232212344685064269'/><link rel='alternate' type='text/html' href='http://cheezyrants.blogspot.com/2009/04/after-putting-it-off-for-long-while-i.html' title='Getting Started with Groovy'/><author><name>Jeff Morgan</name><uri>http://www.blogger.com/profile/01092053330787982041</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/_qbWhAdH5Tnc/SeIdqU-LMKI/AAAAAAAAABw/o7Vv_gPnnoY/S220/Photo+14.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_qbWhAdH5Tnc/SeIXeAFSXpI/AAAAAAAAABg/9LIX2aiXYVs/s72-c/add_grovy_mode.png' height='72' width='72'/><thr:total>0</thr:total></entry></feed>
