Leave a comment

Create a Ruby on Rails TODO application pt. 2

Ok, well with Christmas behind us it is time to get on with our project…

I use Pivotal Tracker for creating stories.  Creating stories is a new thing for me but it really helps to plan out your app.  In fact, if you write your stories well, it make writing our tests easier.

As with any programmer worth their weight in code, I will be creating this app using TDD or BDD depending on how you view those two terms.  In my opinion, Test Driven Development consists of writing the tests before writing the code whereas Behavior Driven Development is writing tests to describe the desired behavior that you want.  With BDD, it is more that you test what an object does and not so much what it is.

On to Pivotal Tracker..  In pt.1 I listed four stories that I added to my Pivotal Tracker account. (https://www.pivotaltracker.com/projects/441447).  One thing that I will not get into is the point estimation for stories in Pivotal Tracker.  That is what Google is for.

Lets start with the first story; As a visitor ISBAT create a note.  Before we do anything, lets think what it is that we want to do.  We want our visitor to be able to create a note.  Now I know that a true TODO app would require user registration or just be for myself only but for this we are going to leave it open for all to use.  So, lets think through the process..

  • Visit the main page
  • Click on link ‘Create Note’
  • Fill in title with ‘Clean the Garage’
  • Fill in description with ‘Get rid of junk and clean out the clutter’
  • Select ‘Due by:’ as 2/1/2012
  • Click on ‘Save’

Pretty simple, isn’t it?  We that is what I will fill in for my Pivotal story under tasks.  Now we are looking and thinking about what we want the user experience to be.  We have not really concerned ourselves with the workflow and have not written a line of code.

The next thing we need to think of is “what do I expect to happen?” if I follow the above steps.

  • I should see ‘Note created successfully’
  • I should not see any error messages
  • The number of notes should increase by 1

Now we know what we expect to do to create a new note and we know what we expect to happen afterwards.  For testing I mentioned that I use Rspec and Capybara.  I am not saying that other testing tools are not good; I just have never used anything but.  Capybara just continues to amaze me.  There are so many different ways to use it that it seems like there is always a solution.  It works great with clicking links, making queries, testing Ajax , and more.  There once was a time that I tried to learn Selenium for automating tests in Firefox but I found it too cumbersome.  Capybara uses Selenium without having to write it!!

I will write my test and post the code in pt.3.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: