Insights and outlooks on software development


On running Cucumber under IronRuby 0.9

Sunday, August 9, 2009 by Thomas L

Updated: changed the path to include IronRuby-0.9.0\bin, removed the need to create our own icucumber.bat script

Previously, I've made some trial shots of running Cucumber under IronRuby to interact with .NET applications, and made a session in an Oresund ALT.NET Open Space around it. The feeling at that time was that IronRuby unfortunately was way too immature to be used effectively in a production environment. During the spring and summer, however, it seems as if the IronRuby team has been working hard on both performance and functionality, giving us a 0.9 release a week ago.

The previous post on IronRuby + Cucumber included some steps of hackish nature, so I thought I should do a new write-up. Follow the steps below, and I hope you'll get everything working as it should.

Installing IronRuby

  • Download the IronRuby zip file.
  • Unpack in c:\ironruby-0.9.0
  • Make sure that c:\ironruby-0.9.0\bin is in the path
  • Test the path by starting a cmd prompt and run 'ir'. The output should say "IronRuby ...". Exit by the command 'exit'.

Installing Cucumber

  • Install required gems: 'igem install --bindir c:\ironruby-0.9.0\bin cucumber rspec'.
    The --bindir argument tells igem to place a cucumber.bat script in the specified folder, so we don't need to create our own batch script
  • Test if cucumber.bat runs as it should by running 'cucumber'. If everything works, you'll get an output saying, "0 scenarios", which means that cucumber can't find any feature to run.

Run Cucumber under IronRuby

  • cd to the cucumber examples directory (for me in my cucumber version, it's C:\ironruby-0.9.0\lib\IronRuby\gems\1.8\gems\cucumber-0.3.94\examples\i18n\en)
  • run 'cucumber features --no-color'.
    If you get output saying something like "4 scenarios (4 passed)", you are on your way!.
    The --no-color switch is to suppress coloring in the output. Apparently, IronRuby + cucumber + the console don't play well with each other, and you'll get garbled output, like e.g. "4 scenarios (←[32m4 passed←[0m)".

Test Cucumber against C# code

  • cd to the C# example directory (..\..\cs if you previously resided in the i18n\en directory).
  • Run compile.bat (if you get complaints on "'csc' is not recognized as an internal or external command, operable program or batch file.", start the visual studio command prompt)
  • run 'icucumber features --no-color'. The output should say "3 scenarios (3 passed)"

Summing up

From here on, it's a bit of work to get Cucumber integrated in your CI build and get everything else working, but this is the first small steps to actually get a working integration between cucumber and .NET code. Previously, the IronRuby process was waaaay to slow to be usable, but now the startup time actually isn't that bad.

Filed under , , , , , , having  

9 kommentarer:

Shri said...

Do you really need to add "SET GEM_PATH="C:\ironruby-0.9.0\lib\IronRuby\gems\1.8"" to icucumber.bat? igem.bat should be able to figure out where to pick up gems from automatically. If not, please do open a bug on

FWIW, aims to provide color support to icucumber. Not sure what state it is in currently.

You probably need c:\ironruby-0.9.0\bin (ie. your instructions did not include the "bin" part) in your path, right?

scitesy said...

This recipe works with one exception as long as I run cucumber from c:\ironruby-0.9.0\bin.

When I run the c# features I get "no such file to load -- Calculator Failed to load ...cs/features/step_definitions/calculator_steps.rb (LoadError)...

scitesy said...

I contributed a bug fix to Cucumber to fix the load error. Not an issue anymore for anyone with a fresh cucumber gem.

Neil Bourgeois said...

This works like a champ. Thanks!

sztupi said...

A workaround I've found for the color/warning issue:
> cucumber 2> NUL | cat

if you don't have unix command line utilities, you can get them from SourceForge, or if you use git anyway, GitExtensions comes with them

ecyware said...

Do you have your presentation online for
Öresund 2009?

Thomas L said...

If you mean the ALT.NET Oresund meeting in April, there's a slideshare presentation embedded here

niclasnilsson said...

Hi Thomas!

Nice writeup! However, you don't need to add --bindir. Rubygems puts them in its own bindir, which in your setup likely would be C:\ironruby-0.9.0\lib\IronRuby\gems\1.8\bin.

Just add a path to that dir and all present and future gems that have binfiles will work.

Kind regards


Rupak Ganguly said...

Nice post. I have a similar post at

We need more people using TDD in .NET/C#.

Rupak Ganguly