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.