Search code examples
cucumbercucumberjs

How to test in cucumber-js a that a result is a multi line string?


I would like to test whenver the result of a step has a certain value, but this value is a multiline string that contains |, - and any special characters.

The string can look like:

{ ------- }|
{aaaaaaaaaa|
{aaaaaaaaaa|

I'm not sure how can I do it in a feature as this will throw me a syntax error:

Feature: asdada

  Scenario: test
    Given test
    When test
    Then the result is:
      { ------- }|
      {aaaaaaaaaa|
      {aaaaaaaaaa|

Solution

  • Example from Is it possible to write a gherkin step on multiple lines?

    thanks to Grasshopper for answering this.

    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.
      """