iCoreTech Research Labs Just a placeholder

18Oct/094

Rails vs. Tarantula

There are times when you, as a lone developer, simply don't have time to write tests.

It's bad but can happen, but I can guarantee that even if your application is small or simple it probably does contains some bugs, especially if you are forced to write it on the fly and fast (which should be the only reason to excuse your lack of tests).

Sending an application straight into production without running tests is bad, I can't stress it enough.

However there's a solution to have some little tests running prior in distributing your app: Tarantula.

Tarantula is a neat ruby gem that can crawl your Rails application looking for problems by following links and eating fixtures, doing automated integration testing; at the end of the crawl you are greeted with an HTML report that tells you what went wrong.

Tarantula uses fixtures in his default configuration to load enough test data to fill your forms and report any problems.

Currently there's an issue where Tarantula flag a resource problem when it deletes a resource first, please see this workaround along with author's comments.

Let's start by installing Tarantula. Oh, don't forget to take a loot at gemcutter, the gem hosting service.

GitHub is still serving gems, so:

gem sources -a http://gems.github.com
gem install relevance-tarantula

Assuming you have Rails 2.1 or higher, add this to your config/environments/test.rb :

config.gem 'relevance-tarantula', :source => "http://gems.github.com", :lib => 'relevance/tarantula'

Rails currently doesn't load Rake tasks from gems, let alone generators (/sadface), so we must include those tasks in Rails' Rakefile, you can find it in the app's root directory, but first, unpack the gem:

mkdir -p vendor/gems
cd vendor/gems
gem unpack relevance-tarantula

And add this line to Rakefile:

load File.join(RAILS_ROOT, Dir["vendor/gems/relevance-tarantula-*/tasks/*.rake"])

Setup Tarantula with:

rake tarantula:setup

And finally, run

rake tarantula:report

This will crawl your application with default settings, starting from '/', only one time, etc. etc.
At the end of the operations Tarantula will open a browser window containing an HTML reports for every action it crawled, with the status and eventual problems.

If you need a custom setup, like how to handle user authentication, please refer to the github page of the project.

Very easy to setup, thumbs up.

Related posts:

  1. Send SMS with Ruby on Rails
  2. My Rails .gitignore
  3. Ruby ordered hash tip with Rails
  4. Rails users < membership > groups? Enter Workflow

Comments (4) Trackbacks (2)
  1. Blog fail! I know how to install a gem in my project, But what does Tarantula do?

  2. oh ehm.
    did you actually read the article? Tarantula is an application that interfaces within your rails app, eating fixtures with test data and crawl your application by using this data and follow links.

    however I added some bits of informations in the article; will be more precise in future.

  3. sounds great ill have to give tarantula a try . thanks!

  4. Thanks, will try it. I’ve was confronted with a huge complex rails application without a single test and the deadline was in two week, awaiting completion of lots of new features. Actually, it was loaded with tons of Ajax requests etc. So bad that I didn’t know about that earlier. Totally agree with :no_tests => :really_bad!


Leave a comment


Additional comments powered by BackType