Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Scenario|ScenarioOutline.name reported as multiline string #356

Closed
os97673 opened this Issue · 8 comments

5 participants

Oleg Sukhodolsky Steve Tooke Matt Wynne Karl Krukow Chris Parsons
Oleg Sukhodolsky
Collaborator

as was discussed at mailing list (https://groups.google.com/d/topic/cukes/4mYe8Tpb5Bs/discussion) cucumber has bug with Senario|ScenarioOutline.name (which is declared in Cucumber::Ast::Names (https://github.com/cucumber/cucumber/blob/master/lib/cucumber/ast/names.rb)).
If we have scenario:
Scenario: line1.
line2.
Given a
And b
Then c
And having before hook:
Before do |scenario|
p [scenario.name]
end
The hook prints name as "line1.\nline2." While scenario name must be one line string.

Steve Tooke
Collaborator

I've just taken a quick look at this.

The Names module is included in the following classes.

  • Background
  • Examples
  • Feature
  • Scenario
  • ScenarioOutline

Currently each of these classes has a @title and @description, and including Names adds readers for those, plus a #name method, which concats them.

Does gherkin define them as name and description for all these elements?

Oleg Sukhodolsky
Collaborator

@tooky from the discussion we had on the mailing list I've got an impression that there is no name property in Gherkin, only title and description.
@mattwynne @aslakhellesoy am I right?

Matt Wynne
Owner

Formally, it goes like this:

Feature: <name>
  <description>

So the code in Cucumber is wrong. It's really wrong actually. IIRC it has the following wrong:

  • it uses #title for what's called name in Gherkin
  • it uses #name for some made-up thing that wraps both name and description from Gherkin

We should get rid of #title altogether, and change #name to return the name from Gherkin.

However we need to be aware that this is changing the API. People like Calabash and Jetbrains particularly will care about this.

cc @krukow

Oleg Sukhodolsky
Collaborator

Perhaps we could just change #name in 1.3.0 and remove title in 2.0. What do you think?

Steve Tooke
Collaborator
Karl Krukow

Thanks for the notification. We would prefer breaking changes deferred to 2.0. We have custom reporters that depend on the semantics.

Oleg Sukhodolsky
Collaborator

I've moved the ticket to 2.0

Chris Parsons chrismdp modified the milestone: 2.0
Matt Wynne
Owner

#name for 2.0 will return the name of the underlying Cucumber::Core::Test::Case which will always be a one-line string.

Matt Wynne mattwynne closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.