Read more

Multi-line step arguments in Cucumber

Henning Koch
September 01, 2010Software engineer at makandra GmbH

The following example is from the Cucumber wiki Show archive.org snapshot :

Given a blog post named "Random" with Markdown body
  """
  Some Title, Eh?
  ==============
  Here is the first paragraph of my blog post. Lorem ipsum dolor sit amet,
  consectetur adipiscing elit.
  """
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 archive.org snapshot

That multi-line string will be given as the last block argument in your step definitions:

Given /^a blog post named "([^\"]*)" with Markdown body$/ do |title, markdown|
  Post.create!(:title => title, :body => markdown)
end
Posted by Henning Koch to makandra dev (2010-09-01 10:20)