Ruby

Cucumber Tip: IRB From Inside a Step Definition

Most Ruby programmers know about Ruby's interactive console, IRB. (If you don't, stop right here, open up a command window and run irb. Type some Ruby code. See how it returns the result of each line right away.) IRB is great for poking around with unfamiliar libraries. Suppose you're using Capybara with Cucumber for the first time. It would be nice to use IRB to experiment with what Capybara can do on a particular page. You could launch an IRB session and duplicate all the Capybara setup from your Cucumber support/env.rb file. But wouldn't it be nice if you could just fire up IRB in the context of a step definition so you know everything in your IRB session matches what you'd get in the step def? Turns out you can. Here's how... Read More

Getting Started with Ruby, Cucumber, and Capybara on Windows

The Ruby version of Cucumber isn't just for Rails developers. If you have a .NET or Java web or service app, Ruby can be a great language for testing. With libraries like Capybara for driving web apps and JSON, RestClient, SOAP, and others for interacting with service apps, you'll find testing in Ruby requires much less code than in C# or Java. It can be hard to find instructions for setting up Ruby and Cucumber on Windows, though, so I've compiled these to help my clients get started, and I thought they might be useful to others. I've tested this on a clean Windows 7 VM, and everything works. Your mileage may vary, but let me know if you have any issues. Read More