Read more

Useful methods to process tables in Cucumber step definitions

Henning Koch
February 01, 2013Software engineer at makandra GmbH

When you accept a table in your Cucumber step definition, that table object will have the cryptic type Cucumber::Ast::Table Show snapshot . Don't immediately call table.raw to convert it into an array of arrays! Cucumber::Ast::Table has a lot of useful methods for tasks such as:

Illustration UI/UX Design

UI/UX Design by makandra brand

We make sure that your target audience has the best possible experience with your digital product. You get:

  • Design tailored to your audience
  • Proven processes customized to your needs
  • An expert team of experienced designers
Read more Show snapshot

: Turn the table into an array of arrays

: Convert the table to an array of hashes, where the keys are the table headers from the first row

: Return only the first row

: Return all but the first row as an array of arrays – you might prefer table.raw or table.rows_hash

: Turn a two-columned table into a hash, where the first column is the keys and the second the values

: Transpose the table (switch rows <-> columns)


  • Mapping natural language table headers to internal identifiers such as attribute names
  • Comparing a table with another table, with pretty diff and all.

Entdecke die Möglichkeiten Show snapshot .

Posted by Henning Koch to makandra dev (2013-02-01 16:23)