cucumber/cucumber-ruby-core

Cucumber::Core::Test::Case#name ignores text after \n character

Closed this issue · 6 comments

na-na commented

I am facing an issue if the scenario outline name spans more than one line. It appends 'Example {##}' after the end of first line, ignoring everything after line #1

I am writing my own formatter , and using the before_test_case method.

Thanks!

Can you give me a concrete example please?

na-na commented

Hi @mattwynne
In the example below, test_case.name would be "I can add a document with title longer than 25 characters but navigation bar"
and not
"I can add a document with title longer than 25 characters but navigation bar
would only display first 15 characters"

On the other hand, in scenario_name(name), name is "I can add a document with title longer than 25 characters but navigation bar
would only display first 15 characters"

Is this by design?

Scenario Outline: I can add a document with title longer than 25 characters but navigation bar
would only display first 15 characters
Given I am logged in as a user with role "<user_role>"
And I ...
And I ...
And I click the document list
And I upload a document with no title
And I ...
When I upload another document with title "A very very very very very very long title"
Then I should see link

Gherkin (v3/v4) clearly define the name of the scenario outline as the text after "Scenario Outline:" until the end of line. The text of the following lines until "Given" (or another keyword) is found, is the (optional) description of the scenario outline (or scenario, or feature etc they all have the same syntax with respect to name and description). See acceptance test feature file and the corresponding AST tree representation.

I do not understand what you mean by "scenario_name(name)".

na-na commented

Thank you @brasmusson. Is there a way to get the optional part of the description then?

Sorry for the brevity, but I meant the name parameter in this method returns the full name. http://www.rubydoc.info/gems/cucumber/Cucumber/Formatter/Html#scenario_name-instance_method

@na-na the methods on that formatter API are being deprecated. There is a way to get what you want, using events, but I need to know a bit more about your use-case.

Please can we continue this discussion on the https://gitter.im/cucumber/cucumber-ruby chat channel? Alternatively, you could open an issue on the front-end repo - the problem you're experiencing won't be fixed in the core I don't think.

lock commented

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.