Provision for multiline in feature, scenario and test steps

2,731 views
Skip to first unread message

jenkins

unread,
May 18, 2011, 4:48:20 AM5/18/11
to Cukes
Is it possible to give multi line feature titles, scenario titles and
steps. If possible, for steps, in the step definition file how this
should be given in the java file {I use cuke4duke & java for step
definitions}

aslak hellesoy

unread,
May 18, 2011, 5:59:40 AM5/18/11
to cu...@googlegroups.com
Features, Scenarios, Scenario Outlines, Backgrounds and Examples can all take an optional name (immediately after the keyword) and an optional multiline description (immediately on the line below the keyword). Example:

Feature: this is my feature title
  I have a description
  that spans
  several lines

  Scenario: this is my scenario title
    My description also
    spans several lines

    Given I can't use several lines on steps though

Steps can only span one line, but you can have multiline strings and tables underneath them: https://github.com/cucumber/cucumber/wiki/Multiline-Step-Arguments


--
You received this message because you are subscribed to the Google Groups "Cukes" group.
To post to this group, send email to cu...@googlegroups.com.
To unsubscribe from this group, send email to cukes+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cukes?hl=en.


Andy Waite

unread,
May 18, 2011, 6:02:51 AM5/18/11
to cu...@googlegroups.com
You have use multi-line strings in your step arguments:

https://github.com/cucumber/cucumber/wiki/Multiline-Step-Arguments

You can't use multiline features in feature titles or scenario titles
but I think this is a good. thing. A long title would make it
difficult to refer to particular features or scenarios in
conversation.

You can however add narrative text after the feature title, and also
between a scenario title and the steps, e.g.:

Scenario: List users

The user list page only shows users who have confirmed their account

Given I am on the admin page
When I...


Andy

aslak hellesoy

unread,
May 18, 2011, 7:10:04 AM5/18/11
to cu...@googlegroups.com
On Wed, May 18, 2011 at 11:02 AM, Andy Waite <an...@andywaite.com> wrote:
You have use multi-line strings in your step arguments:
You can't use multiline features

What do you mean by "multiline features"?
 
in feature titles or scenario titles
but I think this is a good. thing. A long title would make it
difficult to refer to particular features or scenarios in
conversation.


To be more clear on terminology:

[Feature|Scenario|Scenario Outline|Background|Examples]: [TITLE]
  [DESCRIPTION]

Both TITLE and DESCRIPTION are optional. DESCRIPTION can span several lines.

Aslak

Andy Waite

unread,
May 18, 2011, 7:37:45 AM5/18/11
to cu...@googlegroups.com
On 18 May 2011 12:10, aslak hellesoy <aslak.h...@gmail.com> wrote:
>
> What do you mean by "multiline features"?
>

Oops, I meant to write "You can't use multiline titles in features or scenarios"

Andy

aslak hellesoy

unread,
May 18, 2011, 7:50:45 AM5/18/11
to cu...@googlegroups.com
Not sure what you meant by that either - you can. Well, you can provide a multiline description. See the example in my first message in this thread.

Aslak
 
Andy

Matt Wynne

unread,
May 18, 2011, 8:13:03 AM5/18/11
to cu...@googlegroups.com
On 18 May 2011, at 12:10, aslak hellesoy wrote:



On Wed, May 18, 2011 at 11:02 AM, Andy Waite <an...@andywaite.com> wrote:
You have use multi-line strings in your step arguments:
You can't use multiline features

What do you mean by "multiline features"?
 
in feature titles or scenario titles
but I think this is a good. thing. A long title would make it
difficult to refer to particular features or scenarios in
conversation.


To be more clear on terminology:

[Feature|Scenario|Scenario Outline|Background|Examples]: [TITLE]

Interestingly, we call that the name in the domain model. Title is better.

cheers,
Matt

07974 430184

Chuck Kling

unread,
Jun 26, 2015, 9:19:47 PM6/26/15
to cu...@googlegroups.com
To give this thread an update and a correction, multiline scenario titles are accepted as long as none of the line start with the Cuke keywords such as And Given When Then

For instance, the following does not work:

Scenario: Scenario Title

When two things are queued at the same time, then they
  should be queued in alphabetical order. #Scenario description? 

Given our queue is setup to accept inputs
Reply all
Reply to author
Forward
0 new messages