7 days of WordPress plugins, themes & templates - for free! Unlimited asset downloads! Start 7-Day Free Trial
FREELessons: 15Length: 2.5 hours

Next lesson playing in 5 seconds

  • Overview
  • Transcript

2.7 Transforms

Cucumber features are parsed by the 'gherkin' gem. It uses regular expressions to match the behavior you want to provoke. The parsing is done in such a way that it passes strings to your step definitions, so if you need something other than strings, you’ll need to transform that input. Cucumber transforms will help you ease that passage from feature content into proper Ruby code.

Also, if you want to have a set of tabular data that you can process at once, Cucumber lets you have simple ASCII tables that are instantly converted to Ruby hashes. It’s a terrific way, for example, to setup a data source with some quick fixtures. You’ll how to take advantage of those tables, manipulate them and reuse them with transforms as well.