Creating a data-driven test in Ruby using Roo

In the previous recipes, we saw parameterization with Java and .NET; Ruby also has been used widely to create Selenium WebDriver tests.

Again, Ruby does not have its own way to parameterize the script. However, we can use the Roo (http://roo.rubyforge.org/) gem in Ruby to read spreadsheets. Roo supports multiple formats as follows:

  • A locally stored Excel (.xls) file
  • A locally stored OpenOffice (.ods) file
  • An Excel file (.xls) stored in a Confluence wiki page with Confluence Office Connector
  • A Google Docs spreadsheet

Roo is a great alternative to the Ruby Excel COM WIN32 API, as it does not need Excel or OpenOffice installed on the machine. It reads both these files natively.

In this recipe, we will parameterize ...

Get Selenium Testing Tools Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.