The GNU of Life, the Universe and Everything

March 16, 2012

How to make Cucumber run faster

Filed under: Ruby — Tags: , , , , , , , — Pedro Carvalho @ 3:08 am

Speed up the startup time of cucumber for TDD/BDD tests

Getting started with Behaviour Driven Development with Cucumber and noticed that it takes more time to startup than actually run the scenarios.

Compare this:

2 scenarios (2 passed)
4 steps (4 passed)
0m2.252s

real 0m16.013s
user 0m14.850s
sys 0m0.814s

Cucumber reports 0m2.252s but time says 0m16.013s, thats ~~14seconds of difference.

Remember: user time represents the time the application spent on user-mode, actually running the code, where as sys represents the time spent on kernel. real is the full time from start to finish


Using spork as a DRb server

(DRb = Distributed Ruby server)
Note from spork site

Because Spork uses Kernel.fork, it only works on POSIX systems. This means Windows users are not invited to this party. Sorry :(

For your rails app, follow this procedure:

Add spork to your Gemfile

gem 'spork'

Run bundle install

and rails g cucumber:install --spork

Finally run spork server on the background:

bundle exec spork cuc &

And happily run tests:

cucumber features/...


The conclusion: it works!

2 scenarios (2 passed)
4 steps (4 passed)
0m2.956s
Done.

real 0m3.946s
user 0m0.658s
sys 0m0.059s

March 8, 2012

Syntax hightlight theme for Ruby/Rails/Haml in Aptana

Filed under: Aptana, Ruby — Tags: , , , , , , , , , — Pedro Carvalho @ 12:21 am

I have a thing for code and colours. Let it be lolcode, lpsolve syntax for whatever the editor i’m using at the time, i have to tweak it.

This time i’m learning Ruby/Rails/Haml and whatnot. My favorite editor for WebDev has been Aptana with the Clouds theme, (a bit edited already) but it didn’t support ruby. So here it is “Clouds of Ruby”.

What does Clouds of Ruby look like?

Clouds of Ruby :: Ruby/Rails

Ruby/Rails Theme for Aptana

Clouds of Ruby :: HAML

HAML Theme for Aptana

Where to get Clouds of Ruby?

download Clouds of Ruby Theme. I recommend the Anonymous Pro font to go well with it.

To use, go to Preferences->Aptana Studio->Themes->Import. Change at will and have fun coding!

Theme: Shocking Blue Green. Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.