Doc Strings

Doc strings just allow you to specify a larger piece of text than you could fit on a single line. For example, if you need to describe the precise content of an email message, you could do it like this:

 Scenario​: Ban Unscrupulous Users
  When I behave unscrupulously
 Then I should receive an email containing​:
 """
  Dear Sir,
 
  Your account privileges have been revoked due to your unscrupulous behavior.
 
  Sincerely,
  The Management
  """
  And my account should be locked

Just like a data table, the entire string between the """ triple quotes is attached to the step above it. The indentation of the opening """ is not important, although common practice is to indent two spaces in from the enclosing step, as ...

Get The Cucumber Book, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.