Debugging Specs

Posted on Sun Feb 17 00:11:00 UTC 2008

It is easy enough to debug specs on by one. For this you just run the ruby file that contains the spec with ruby-debug instead of ruby:

rdebug spec/rur_spec.rb

But when running via rake, you can’t do this. A simple solution is to add these lines in the spec file you want to debug (or in spec_helper.rb):

require_library_or_gem 'ruby-debug'
Debugger.start

And you are in business…

Posted in Rails, Testing  |  Tags ,  |  1 comment

Selenium IDE

Posted on Wed Mar 15 14:48:00 UTC 2006

Along the line of finding a solution for automating your user testing, if writing a script is not your cup of tea, you can use Selenium IDE to help you record your steps in the browser, complete with some assertions. Check out the demo: Automating a Google search

The downside (if that was one :D) is that you need to use firefox.

Download the firefox extension

Fore more details, visit the Selenium IDE site.

Posted in Testing  |  Tags ,  |  0 comments

Best practices

Posted on Tue Mar 14 15:35:00 UTC 2006

glu.ttono.us has posted an excellent summary of his take on Rails best practices.

And I think I need to do some reading, that the second time in as many days that someone mentions Refactoring by Martin Fowler, and this has me intrigued.

My top favorites:

  • testing of course
  • I second Luke. Selenium and Selenium on Rails is a better approach for functional (and user type testing). I’m not saying this should replace it. Use both techniques.
  • DRY (Don’t Repeat Yourself)

Posted in Rails, Testing  |  Tags ,  |  0 comments

Integration Testing in Rails 1.1

Posted on Sat Mar 11 07:56:00 UTC 2006

I must have been asleep at the keyboard the first time I read Jamis article on Integration Testing in Rails 1.1. as it didn’t register as being so promising that it was worth a second look.

You can find the full description on Jamis the { buckblogs :here }.

This is going to be an invaluable tool to test my Rails applications. True, it won’t catch the Javascript problems, but it will help find a lot of the integration issues between the various pages and help me exercise all critical use cases. As you may know, no single testing technique can catch all problems (it is really the combination of all techniques working in tandem that help), and this one is going to be a very important one. And we all know that if adding a test is that easy, then there is no excuse for not doing it ;)

In fact, I’m quite excited at the prospect of giving it a test drive! Thanks Jamis!

3/15 update: and if you can’t wait, you can read Damien Tanner’s article on the subject.

Now I just need to figure out how to play with the trunk without breaking my current installation. I’ll cover that when I get to it.

update #2: scratch my previous comment, there is a good description on how to use the trunk, a.k.a. EdgeRails on rubyonrails.com.

Posted in Rails, Testing  |  Tags  |  0 comments