New Blog
August 12th, 2009
Started a new blog over at richdownie.com. You may ask, “Why would I reinvent the wheel” knowing that setting up a blog is simple and free with Google or Wordpress. I decided to build my own blog BDD style. richdownie.com/blog has sufficient cucumber, watir and rspec tests tied to it. I’m seeing the benefits already. With a simple “git co -b test” command, I can play with new feature enhancements, run my security suite and then decide if it’s worth keeping. If not, I can just “git branch test -d” and I’m laughing. Check out the screencast in my latest post, and see for yourself.
watircuke (Watir and Cucumber)
June 11th, 2009
Watircuke is a project I’m starting and can be cloned over at Github. If you’re looking for easy, fast and reliable automated “Cross-Browser” testing, you may want to give my framework a spin.
Cheers!
Try adding cucumber to watir
April 17th, 2009

Cucumber is the hot new testing tool that can execute plain-text documents as automated functional tests. Cucumber basically consists of features and steps with some handy-dandy support files. Watir is an open-source library for automating web browsers. I am finding huge productivity gains when combing the two.
Install Cucumber / Watir and execute ruby script/generate cucumber inside your Rails app.
This will generate the below features folder.

Now open the support folder and add the watir configuration code to your env.rb.
Ok now that we are all configured let’s take a look at some code, starting with my sample security.feature.

Notice Line 4 “Given I am on the login page“. Cucumber takes this line and treats it as a regular expression. It will try and find a match in either the step_definitions and/or support folder. “the login page” portion can be found inside paths.rb in my support directory under the “path_to(page_name)” method.


So now any feature steps that end in “the login page” will send the browser to the url “http://deploy.visualcv.com/login”, thanks to watir.
But what about the “I am on” portion? Well, that can be found in the page_steps.rb under the step_definitions directory.


See how “.goto” watir method points to the (page_to(page_name)) method found in paths.rb. That is how “Given I am on the login page” gets executed properly from the security.feature.
Good news? That is as complex as it gets. Now for the easy steps.
Let’s take a look at Line 5 of the security.feature And I click the link “Forgot Your Password?“. Under the step_definitions directory I have a link_steps.rb file.

All I am doing here is passing in the text “Forgot Your Password?” into the watir hash via the block(|text|). I can pass in any link text I wish to this one line of code. Talk about Refactoring your code.
So, I’ve decided to keep the same concept with buttons, assertions, text_fields, etc…



This makes scripting very fast, very organized, very easy and very English.
Enough code talk, let’s see some action in a ScreenCast!
rails redefines “Up and Running”
February 11th, 2009
I highly recommend updating to Rails 2.3 and checking out Templates. If your tired of trying to figure out which gems or plugins you might need for your next project, you can script a template that will prompt you for your favs. “Do you want rspec for this project?” Yes Please. Tired of .gitignoring the same silly files? Done! Now if you really wanna fry your noodle, store different templates up at your github account and remotely call these templates whenever you generate a new $app.
united we stand, divided they fall
December 24th, 2008
I first heard about Merb from Ezra Zygmuntowicz @RubyEast in September of ‘07. My first thought was, hmmm… what will this do to Rails? I played with Merb a little bit to see what all the hub-bub was about. Impressive! My buddy and I are planning to use it in our next project.
Then I saw this tweet yesterday from DHH.
“Merb gets merged into Rails 3: http://is.gd/dbnC — what a great day for the community! Read also Yehuda’s take: http://is.gd/dbnP“
I was pretty excited and shocked at first. Not sure how often this happens in other camps, but now that I think about it…it is classic Ruby. You see, Ruby is not just a fantastic language but the people involved are all about collaboration. We focus on community and not about self-interests. For example, I received an email last week from Chad Fowler, asking me to review his next book. I attended one of Chad’s trainings back in March and bumped into him at a couple conferences. I was not expecting to be honored with such a favor. But hey, this is the Ruby Community. This is what it’s all about.
|


