Question

Is there any way of passing parameters containing newline characters into Cucumber-JVM scenarios?

As a workaround I'm putting "\n" strings into the parameter and replacing them with a newline at the beginning of the scenario method but it feels as if there might be a nicer way.

Was it helpful?

Solution

You can use Doc Strings using triple-quote. Example stolen from official wiki http://cukes.info/step-definitions.html

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.
  """
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top