Discussion:
[Cucumber] Why can't I put comments at the end of a line?
(too old to reply)
Trevor Harmon
2012-10-31 20:03:38 UTC
Permalink
I want to be able to do:

Feature: foo
Scenario: bar
Given baz # This is a comment

and have Cucumber ignore "This is a comment".

But instead Cucumber thinks the comment is part of the step!

Given /^baz \# This is a comment$/ do
pending # express the regexp above with the code you wish you had
end

Am I doing something wrong, or is this a bug?

--
-- Rules --

1) Please prefix the subject with [Ruby], [JVM] or [JS].
2) Please use interleaved answers http://en.wikipedia.org/wiki/Posting_style#Interleaved_style
3) If you have a question, don't reply to an existing message. Start a new topic instead.

You received this message because you are subscribed to the Google Groups Cukes group. To post to this group, send email to cukes-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org To unsubscribe from this group, send email to cukes+***@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/cukes?hl=en
aslak hellesoy
2012-10-31 20:15:38 UTC
Permalink
On Wed, Oct 31, 2012 at 8:03 PM, Trevor Harmon <trevor-ebqu8CYYB8DQT0dZR+***@public.gmane.org> wrote:

> I want to be able to do:
>
> Feature: foo
> Scenario: bar
> Given baz # This is a comment
>
> and have Cucumber ignore "This is a comment".
>
> But instead Cucumber thinks the comment is part of the step!
>
> Given /^baz \# This is a comment$/ do
> pending # express the regexp above with the code you wish you had
> end
>
> Am I doing something wrong, or is this a bug?
>

It's by design. Primarily because it simplifies the generated AST and all
the code manipulating it.
This is required for pretty printing.

I agree it would be nice to have a more flexible grammar here. the AST
could look something like:

{
line: 20,
keyword: 'Given ',
name: 'Something',
comments: {
19: 'above',
21: 'below'
}
}

It's not a high priority change, but I would be glad to take a patch for
all implemented languages - ruby, java, javascript.
I'd say a day or so of work ;-)

Aslak

> --
> -- Rules --
>
> 1) Please prefix the subject with [Ruby], [JVM] or [JS].
> 2) Please use interleaved answers
> http://en.wikipedia.org/wiki/Posting_style#Interleaved_style
> 3) If you have a question, don't reply to an existing message. Start a new
> topic instead.
>
> You received this message because you are subscribed to the Google Groups
> Cukes group. To post to this group, send email to cukes-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
> To unsubscribe from this group, send email to
> cukes+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org For more options, visit this group at
> https://groups.google.com/d/forum/cukes?hl=en
>
>
>

--
-- Rules --

1) Please prefix the subject with [Ruby], [JVM] or [JS].
2) Please use interleaved answers http://en.wikipedia.org/wiki/Posting_style#Interleaved_style
3) If you have a question, don't reply to an existing message. Start a new topic instead.

You received this message because you are subscribed to the Google Groups Cukes group. To post to this group, send email to cukes-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org To unsubscribe from this group, send email to cukes+***@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/cukes?hl=en
aslak hellesoy
2012-10-31 20:17:31 UTC
Permalink
On Wed, Oct 31, 2012 at 8:15 PM, aslak hellesoy <aslak.hellesoy-***@public.gmane.org>wrote:

>
>
> On Wed, Oct 31, 2012 at 8:03 PM, Trevor Harmon <trevor-ebqu8CYYB8DQT0dZR+***@public.gmane.org> wrote:
>
>> I want to be able to do:
>>
>> Feature: foo
>> Scenario: bar
>> Given baz # This is a comment
>>
>> and have Cucumber ignore "This is a comment".
>>
>> But instead Cucumber thinks the comment is part of the step!
>>
>> Given /^baz \# This is a comment$/ do
>> pending # express the regexp above with the code you wish you had
>> end
>>
>> Am I doing something wrong, or is this a bug?
>>
>
> It's by design.
>

What I meant here is the limitation that comments have to be at the start
of a line.
If you search in the archives you'll find some discussions about it.


> Primarily because it simplifies the generated AST and all the code
> manipulating it.
> This is required for pretty printing.
>
> I agree it would be nice to have a more flexible grammar here. the AST
> could look something like:
>
> {
> line: 20,
> keyword: 'Given ',
> name: 'Something',
> comments: {
> 19: 'above',
> 21: 'below'
> }
> }
>
> It's not a high priority change, but I would be glad to take a patch for
> all implemented languages - ruby, java, javascript.
> I'd say a day or so of work ;-)
>
> Aslak
>
>> --
>> -- Rules --
>>
>> 1) Please prefix the subject with [Ruby], [JVM] or [JS].
>> 2) Please use interleaved answers
>> http://en.wikipedia.org/wiki/Posting_style#Interleaved_style
>> 3) If you have a question, don't reply to an existing message. Start a
>> new topic instead.
>>
>> You received this message because you are subscribed to the Google Groups
>> Cukes group. To post to this group, send email to cukes-/***@public.gmane.org.
>> To unsubscribe from this group, send email to
>> cukes+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org For more options, visit this group
>> at https://groups.google.com/d/forum/cukes?hl=en
>>
>>
>>
>
>

--
-- Rules --

1) Please prefix the subject with [Ruby], [JVM] or [JS].
2) Please use interleaved answers http://en.wikipedia.org/wiki/Posting_style#Interleaved_style
3) If you have a question, don't reply to an existing message. Start a new topic instead.

You received this message because you are subscribed to the Google Groups Cukes group. To post to this group, send email to cukes-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org To unsubscribe from this group, send email to cukes+***@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/cukes?hl=en
Trevor Harmon
2012-11-01 05:00:03 UTC
Permalink
I don't understand what you mean by "simplifies the AST". Comments
shouldn't even reach the parser. They should be removed by the lexer,
should they not? A one-pass scan can easily remove all comments, whether
they are on a line by themselves or following a legal statement. (I admit I
know nothing about how Cucumber actually interprets Gherkin.)

Trevor

On Wednesday, October 31, 2012 1:16:00 PM UTC-7, Aslak Hellesøy wrote:
>
>
>
> On Wed, Oct 31, 2012 at 8:03 PM, Trevor Harmon <tre...-ebqu8CYYB8DQT0dZR+***@public.gmane.org<javascript:>
> > wrote:
>
>> I want to be able to do:
>>
>> Feature: foo
>> Scenario: bar
>> Given baz # This is a comment
>>
>> and have Cucumber ignore "This is a comment".
>>
>> But instead Cucumber thinks the comment is part of the step!
>>
>> Given /^baz \# This is a comment$/ do
>> pending # express the regexp above with the code you wish you had
>> end
>>
>> Am I doing something wrong, or is this a bug?
>>
>
> It's by design. Primarily because it simplifies the generated AST and all
> the code manipulating it.
> This is required for pretty printing.
>
> I agree it would be nice to have a more flexible grammar here. the AST
> could look something like:
>
> {
> line: 20,
> keyword: 'Given ',
> name: 'Something',
> comments: {
> 19: 'above',
> 21: 'below'
> }
> }
>
> It's not a high priority change, but I would be glad to take a patch for
> all implemented languages - ruby, java, javascript.
> I'd say a day or so of work ;-)
>
> Aslak
>
>> --
>> -- Rules --
>>
>> 1) Please prefix the subject with [Ruby], [JVM] or [JS].
>> 2) Please use interleaved answers
>> http://en.wikipedia.org/wiki/Posting_style#Interleaved_style
>> 3) If you have a question, don't reply to an existing message. Start a
>> new topic instead.
>>
>> You received this message because you are subscribed to the Google Groups
>> Cukes group. To post to this group, send email to cu...-/***@public.gmane.org<javascript:>.
>> To unsubscribe from this group, send email to
>> cukes+un...-/***@public.gmane.org <javascript:>. For more options, visit this
>> group at https://groups.google.com/d/forum/cukes?hl=en
>>
>>
>>
>
>

--
-- Rules --

1) Please prefix the subject with [Ruby], [JVM] or [JS].
2) Please use interleaved answers http://en.wikipedia.org/wiki/Posting_style#Interleaved_style
3) If you have a question, don't reply to an existing message. Start a new topic instead.

You received this message because you are subscribed to the Google Groups Cukes group. To post to this group, send email to cukes-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org To unsubscribe from this group, send email to cukes+***@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/cukes?hl=en
aslak hellesoy
2012-11-01 09:57:16 UTC
Permalink
On Thu, Nov 1, 2012 at 5:00 AM, Trevor Harmon <trevor-ebqu8CYYB8DQT0dZR+***@public.gmane.org> wrote:

> I don't understand what you mean by "simplifies the AST". Comments
> shouldn't even reach the parser.


If I was writing a parser for an interpreter or compiler where the source
code formatting doesn't matter that may be true.
This is not the case for Cucumber. In order to format results with all the
information from the source (applies to html, json and pretty formatter),
the comment nodes have to be in the AST and not be discarded as you suggest.

Why do we need to output comments in the output? Well, it could be that
someone writes scenarios and steps where the names and descriptions aren't
self explanatory, and put extra information in comments.

A report without those comments would lack important information.

Moreover, since the pretty formatter outputs stepdef locations at the end
of a line, this would look weird if the source could have comments here too:

Given I have 5 cukes # A cuke is a cucumber #
features/step_definitions/cuke_steps.rb:45

Aslak

They should be removed by the lexer, should they not? A one-pass scan can
> easily remove all comments, whether they are on a line by themselves or
> following a legal statement. (I admit I know nothing about how Cucumber
> actually interprets Gherkin.)
>
> Trevor
>
> On Wednesday, October 31, 2012 1:16:00 PM UTC-7, Aslak Hellesøy wrote:
>>
>>
>>
>> On Wed, Oct 31, 2012 at 8:03 PM, Trevor Harmon <tre...-ebqu8CYYB8DQT0dZR+***@public.gmane.org> wrote:
>>
>>> I want to be able to do:
>>>
>>> Feature: foo
>>> Scenario: bar
>>> Given baz # This is a comment
>>>
>>> and have Cucumber ignore "This is a comment".
>>>
>>> But instead Cucumber thinks the comment is part of the step!
>>>
>>> Given /^baz \# This is a comment$/ do
>>> pending # express the regexp above with the code you wish you had
>>> end
>>>
>>> Am I doing something wrong, or is this a bug?
>>>
>>
>> It's by design. Primarily because it simplifies the generated AST and all
>> the code manipulating it.
>> This is required for pretty printing.
>>
>> I agree it would be nice to have a more flexible grammar here. the AST
>> could look something like:
>>
>> {
>> line: 20,
>> keyword: 'Given ',
>> name: 'Something',
>> comments: {
>> 19: 'above',
>> 21: 'below'
>> }
>> }
>>
>> It's not a high priority change, but I would be glad to take a patch for
>> all implemented languages - ruby, java, javascript.
>> I'd say a day or so of work ;-)
>>
>> Aslak
>>
>>> --
>>> -- Rules --
>>>
>>> 1) Please prefix the subject with [Ruby], [JVM] or [JS].
>>> 2) Please use interleaved answers http://en.wikipedia.org/wiki/**
>>> Posting_style#Interleaved_**style<http://en.wikipedia.org/wiki/Posting_style#Interleaved_style>
>>> 3) If you have a question, don't reply to an existing message. Start a
>>> new topic instead.
>>>
>>> You received this message because you are subscribed to the Google
>>> Groups Cukes group. To post to this group, send email to
>>> cu...-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org To unsubscribe from this group, send email to
>>> cukes+un...@**googlegroups.com. For more options, visit this group at
>>> https://groups.google.com/d/**forum/cukes?hl=en<https://groups.google.com/d/forum/cukes?hl=en>
>>>
>>>
>>>
>>
>> --
> -- Rules --
>
> 1) Please prefix the subject with [Ruby], [JVM] or [JS].
> 2) Please use interleaved answers
> http://en.wikipedia.org/wiki/Posting_style#Interleaved_style
> 3) If you have a question, don't reply to an existing message. Start a new
> topic instead.
>
> You received this message because you are subscribed to the Google Groups
> Cukes group. To post to this group, send email to cukes-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
> To unsubscribe from this group, send email to
> cukes+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org For more options, visit this group at
> https://groups.google.com/d/forum/cukes?hl=en
>
>
>

--
-- Rules --

1) Please prefix the subject with [Ruby], [JVM] or [JS].
2) Please use interleaved answers http://en.wikipedia.org/wiki/Posting_style#Interleaved_style
3) If you have a question, don't reply to an existing message. Start a new topic instead.

You received this message because you are subscribed to the Google Groups Cukes group. To post to this group, send email to cukes-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org To unsubscribe from this group, send email to cukes+***@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/cukes?hl=en
George Dinwiddie
2012-10-31 20:44:24 UTC
Permalink
Trevor,

On 10/31/12 4:03 PM, Trevor Harmon wrote:
> I want to be able to do:
>
> |
> Feature: foo
> Scenario: bar
> Given baz # This is a comment
> |
>
> and have Cucumber ignore "This is a comment".
>
> But instead Cucumber thinks the comment is part of the step!

Yes, Cucumber accepts all characters in a gherkin statement.

> |
> Given /^baz \# This is a comment$/ do
> pending # express the regexp above with the code you wish you had
> end
> |
>
> Am I doing something wrong, or is this a bug?

You're doing something wrong. :-) Your "Given" line should be
self-explanatory, and shouldn't need a comment. It's not code. It's as
close to the natural language of the business as possible. The word
"baz" just doesn't communicate enough.

Can you show the real thing? Perhaps we can help you reword the step to
incorporate the comment.

- George


--
----------------------------------------------------------------------
* George Dinwiddie * http://blog.gdinwiddie.com
Software Development http://www.idiacomputing.com
Consultant and Coach http://www.agilemaryland.org
----------------------------------------------------------------------

--
-- Rules --

1) Please prefix the subject with [Ruby], [JVM] or [JS].
2) Please use interleaved answers http://en.wikipedia.org/wiki/Posting_style#Interleaved_style
3) If you have a question, don't reply to an existing message. Start a new topic instead.

You received this message because you are subscribed to the Google Groups Cukes group. To post to this group, send email to cukes-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org To unsubscribe from this group, send email to cukes+***@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/cukes?hl=en
Trevor Harmon
2012-11-01 04:45:15 UTC
Permalink
I agree that Cucumber statements should be as literate as possible, but
there are always situations where a little commentary can save time.

In my situation, I am trying to simulate the user choosing options from a
lunch menu. There are many different restaurants, and each restaurant has
its own menu, but they are all presented as a series of options: e.g.,
"Choose your soup type", "Choose your noodle type", "Choose your
vegetable". For this scenario, the particular restaurant and menu
selections are unimportant; I simply need to drill down through some series
of options to complete the order.

I have a custom step defined as "I touch list item number (\d+)" that
selects the menu option at the given index.

And here is a snippet of the code:

And I touch list item number 2 # House of Thai Restaurant
And I touch list item number 1 # Slice of Beef Noodle Soup
And I touch list item number 1 # Choose your Noodles
And I touch list item number 1 # Flat Rice Noodle
And I touch list item number 3 # Spinach or Watercress
And I touch list item number 1 # Spinach

I suppose I could define a new step like "I touch menu option (.*)" and
then rewrite the scenario as:

...
And I touch menu option "Flat Rice Noodle"
And I touch menu option "Spinach"

But creating an entirely new step just to make this one scenario a little
more readable seems like more trouble than it was worth. Or would that be
the Cucumber way?

Trevor

On Wednesday, October 31, 2012 1:44:29 PM UTC-7, George Dinwiddie wrote:
>
> Trevor,
>
> On 10/31/12 4:03 PM, Trevor Harmon wrote:
> > I want to be able to do:
> >
> > |
> > Feature: foo
> > Scenario: bar
> > Given baz # This is a comment
> > |
> >
> > and have Cucumber ignore "This is a comment".
> >
> > But instead Cucumber thinks the comment is part of the step!
>
> Yes, Cucumber accepts all characters in a gherkin statement.
>
> > |
> > Given /^baz \# This is a comment$/ do
> > pending # express the regexp above with the code you wish you had
> > end
> > |
> >
> > Am I doing something wrong, or is this a bug?
>
> You're doing something wrong. :-) Your "Given" line should be
> self-explanatory, and shouldn't need a comment. It's not code. It's as
> close to the natural language of the business as possible. The word
> "baz" just doesn't communicate enough.
>
> Can you show the real thing? Perhaps we can help you reword the step to
> incorporate the comment.
>
> - George
>
>
> --
> ----------------------------------------------------------------------
> * George Dinwiddie * http://blog.gdinwiddie.com
> Software Development http://www.idiacomputing.com
> Consultant and Coach http://www.agilemaryland.org
> ----------------------------------------------------------------------
>
>

--
-- Rules --

1) Please prefix the subject with [Ruby], [JVM] or [JS].
2) Please use interleaved answers http://en.wikipedia.org/wiki/Posting_style#Interleaved_style
3) If you have a question, don't reply to an existing message. Start a new topic instead.

You received this message because you are subscribed to the Google Groups Cukes group. To post to this group, send email to cukes-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org To unsubscribe from this group, send email to cukes+***@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/cukes?hl=en
George Dinwiddie
2012-11-01 05:29:53 UTC
Permalink
Trevor,

On 11/1/12 12:45 AM, Trevor Harmon wrote:
> I agree that Cucumber statements should be as literate as possible, but
> there are always situations where a little commentary can save time.

There are also times when you might want to do something like

When I dial "314#" on the telephone

or other cases where you want a # sign in your step.

>
> In my situation, I am trying to simulate the user choosing options from
> a lunch menu. There are many different restaurants, and each restaurant
> has its own menu, but they are all presented as a series of options:
> e.g., "Choose your soup type", "Choose your noodle type", "Choose your
> vegetable". For this scenario, the particular restaurant and menu
> selections are unimportant; I simply need to drill down through some
> series of options to complete the order.
>
> I have a custom step defined as "I touch list item number (\d+)" that
> selects the menu option at the given index.
>
> And here is a snippet of the code:
>
> And I touch list item number 2 # House of Thai Restaurant
> And I touch list item number 1 # Slice of Beef Noodle Soup
> And I touch list item number 1 # Choose your Noodles
> And I touch list item number 1 # Flat Rice Noodle
> And I touch list item number 3 # Spinach or Watercress
> And I touch list item number 1 # Spinach
>
> I suppose I could define a new step like "I touch menu option (.*)" and
> then rewrite the scenario as:
>
> ...
> And I touch menu option "Flat Rice Noodle"
> And I touch menu option "Spinach"
>
> But creating an entirely new step just to make this one scenario a
> little more readable seems like more trouble than it was worth. Or would
> that be the Cucumber way?

No, the cucumber way would be more declarative:

When I order "Slice of Beef Noodle Soup" with "Flat Rice Noodles" and
"Spinach" at the "House of Thai Restaurant

and put the navigation in the step definition. (I generally use some
sort of table lookup to make it easy to change)

Using the imperative form is quite fragile and, as you noticed, hard to
read and understand the purpose of the test.

- George

--
----------------------------------------------------------------------
* George Dinwiddie * http://blog.gdinwiddie.com
Software Development http://www.idiacomputing.com
Consultant and Coach http://www.agilemaryland.org
----------------------------------------------------------------------

--
-- Rules --

1) Please prefix the subject with [Ruby], [JVM] or [JS].
2) Please use interleaved answers http://en.wikipedia.org/wiki/Posting_style#Interleaved_style
3) If you have a question, don't reply to an existing message. Start a new topic instead.

You received this message because you are subscribed to the Google Groups Cukes group. To post to this group, send email to cukes-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org To unsubscribe from this group, send email to cukes+***@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/cukes?hl=en
Trevor Harmon
2012-11-01 06:08:28 UTC
Permalink
On Wednesday, October 31, 2012 10:29:57 PM UTC-7, George Dinwiddie wrote:
>
> There are also times when you might want to do something like
>
> When I dial "314#" on the telephone
>
> or other cases where you want a # sign in your step.


A comment symbol inside a string is easily handled by a lexer's state
machine.

I agree that comments at the end of a line should be avoided on principle,
but there's no technical reason that precludes them. In fact, Gherkin is
the only language I know of that allows single-line comments at the
beginning of a line but disallows them at the end of a line.

--
-- Rules --

1) Please prefix the subject with [Ruby], [JVM] or [JS].
2) Please use interleaved answers http://en.wikipedia.org/wiki/Posting_style#Interleaved_style
3) If you have a question, don't reply to an existing message. Start a new topic instead.

You received this message because you are subscribed to the Google Groups Cukes group. To post to this group, send email to cukes-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org To unsubscribe from this group, send email to cukes+***@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/cukes?hl=en
aslak hellesoy
2012-11-01 09:29:23 UTC
Permalink
On Thu, Nov 1, 2012 at 6:08 AM, Trevor Harmon <trevor-ebqu8CYYB8DQT0dZR+***@public.gmane.org> wrote:

> On Wednesday, October 31, 2012 10:29:57 PM UTC-7, George Dinwiddie wrote:
>>
>> There are also times when you might want to do something like
>>
>> When I dial "314#" on the telephone
>>
>> or other cases where you want a # sign in your step.
>
>
> A comment symbol inside a string is easily handled by a lexer's state
> machine.
>
>
Not in the gherkin lexer - there is no such thing as strings. Quotes or
double quotes are not lexical tokens.


> I agree that comments at the end of a line should be avoided on principle,
> but there's no technical reason that precludes them. In fact, Gherkin is
> the only language I know of that allows single-line comments at the
> beginning of a line but disallows them at the end of a line.
>
>
That may well be. It's optimised for free-form text.

Aslak

> --
> -- Rules --
>
> 1) Please prefix the subject with [Ruby], [JVM] or [JS].
> 2) Please use interleaved answers
> http://en.wikipedia.org/wiki/Posting_style#Interleaved_style
> 3) If you have a question, don't reply to an existing message. Start a new
> topic instead.
>
> You received this message because you are subscribed to the Google Groups
> Cukes group. To post to this group, send email to cukes-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
> To unsubscribe from this group, send email to
> cukes+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org For more options, visit this group at
> https://groups.google.com/d/forum/cukes?hl=en
>
>
>

--
-- Rules --

1) Please prefix the subject with [Ruby], [JVM] or [JS].
2) Please use interleaved answers http://en.wikipedia.org/wiki/Posting_style#Interleaved_style
3) If you have a question, don't reply to an existing message. Start a new topic instead.

You received this message because you are subscribed to the Google Groups Cukes group. To post to this group, send email to cukes-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org To unsubscribe from this group, send email to cukes+***@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/cukes?hl=en
George Dinwiddie
2012-11-01 16:14:52 UTC
Permalink
Trevor,

On 11/1/12 2:08 AM, Trevor Harmon wrote:
> On Wednesday, October 31, 2012 10:29:57 PM UTC-7, George Dinwiddie wrote:
>
> There are also times when you might want to do something like
>
> When I dial "314#" on the telephone
>
> or other cases where you want a # sign in your step.
>
>
> A comment symbol inside a string is easily handled by a lexer's state
> machine.

OK, substitute a different step. Maybe

Then the floober accepts the # sign.

The point is to allow expression that's most natural for the business.

- George

--
----------------------------------------------------------------------
* George Dinwiddie * http://blog.gdinwiddie.com
Software Development http://www.idiacomputing.com
Consultant and Coach http://www.agilemaryland.org
----------------------------------------------------------------------

--
-- Rules --

1) Please prefix the subject with [Ruby], [JVM] or [JS].
2) Please use interleaved answers http://en.wikipedia.org/wiki/Posting_style#Interleaved_style
3) If you have a question, don't reply to an existing message. Start a new topic instead.

You received this message because you are subscribed to the Google Groups Cukes group. To post to this group, send email to cukes-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org To unsubscribe from this group, send email to cukes+***@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/cukes?hl=en
Andrey Botalov
2012-11-25 10:57:09 UTC
Permalink
It seems that so far main drawbacks of end of line comments are:

1. # signs can be used in free form text. I think it can be mitigated with
some sort of escaping:
Given I do something # This is comment
Given I do something ## This is not comment
Given I do something ### This is not comment

(# is a symbol that needs escaping to be used in free form text. 2 #'s
means 1 #; 3#'s means 2 #'s)

If you think, it's too confusing, maybe, # should be changed to more rarely
used symbol like //.

2. # sign is used in pretty formatter:
Given I have 5 cukes # A cuke is a cucumber #
features/step_definitions/cuke_steps.rb:45

Different colors can be used for Gherkin comments and for those special
pretty printing comments.

So I think those drawbacks can be mitigated and it's possible to have
end-of-line comments in Gherkin

--
-- Rules --

1) Please prefix the subject with [Ruby], [JVM] or [JS].
2) Please use interleaved answers http://en.wikipedia.org/wiki/Posting_style#Interleaved_style
3) If you have a question, don't reply to an existing message. Start a new topic instead.

You received this message because you are subscribed to the Google Groups Cukes group. To post to this group, send email to cukes-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org To unsubscribe from this group, send email to cukes+***@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/cukes?hl=en
Andrew Premdas
2012-11-25 11:33:53 UTC
Permalink
On 25 November 2012 10:57, Andrey Botalov <botalov.andrey-***@public.gmane.org> wrote:

> It seems that so far main drawbacks of end of line comments are:
>
> 1. # signs can be used in free form text. I think it can be mitigated with
> some sort of escaping:
> Given I do something # This is comment
> Given I do something ## This is not comment
> Given I do something ### This is not comment
>
> (# is a symbol that needs escaping to be used in free form text. 2 #'s
> means 1 #; 3#'s means 2 #'s)
>
> If you think, it's too confusing, maybe, # should be changed to more
> rarely used symbol like //.
>
> 2. # sign is used in pretty formatter:
> Given I have 5 cukes # A cuke is a cucumber #
> features/step_definitions/cuke_steps.rb:45
>
> Different colors can be used for Gherkin comments and for those special
> pretty printing comments.
>
> So I think those drawbacks can be mitigated and it's possible to have
> end-of-line comments in Gherkin
>
> Just because its technically possible, doesn't mean it should be done. End
of line comments have no place in cucumber features, if your step needs a
comment to explain something then it needs to be re-written.

Andrew


> --
> -- Rules --
>
> 1) Please prefix the subject with [Ruby], [JVM] or [JS].
> 2) Please use interleaved answers
> http://en.wikipedia.org/wiki/Posting_style#Interleaved_style
> 3) If you have a question, don't reply to an existing message. Start a new
> topic instead.
>
> You received this message because you are subscribed to the Google Groups
> Cukes group. To post to this group, send email to cukes-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
> To unsubscribe from this group, send email to
> cukes+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org For more options, visit this group at
> https://groups.google.com/d/forum/cukes?hl=en
>
>
>



--
------------------------
Andrew Premdas
blog.andrew.premdas.org

--
-- Rules --

1) Please prefix the subject with [Ruby], [JVM] or [JS].
2) Please use interleaved answers http://en.wikipedia.org/wiki/Posting_style#Interleaved_style
3) If you have a question, don't reply to an existing message. Start a new topic instead.

You received this message because you are subscribed to the Google Groups Cukes group. To post to this group, send email to cukes-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org To unsubscribe from this group, send email to cukes+***@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/cukes?hl=en
Andrey Botalov
2012-11-25 12:12:21 UTC
Permalink
On Sunday, November 25, 2012 2:33:57 PM UTC+3, apremdas wrote:

> On 25 November 2012 10:57, Andrey Botalov <botalov...-***@public.gmane.org<javascript:>
> > wrote:
>
>> It seems that so far main drawbacks of end of line comments are:
>>
>> 1. # signs can be used in free form text. I think it can be mitigated
>> with some sort of escaping:
>> Given I do something # This is comment
>> Given I do something ## This is not comment
>> Given I do something ### This is not comment
>>
>> (# is a symbol that needs escaping to be used in free form text. 2 #'s
>> means 1 #; 3#'s means 2 #'s)
>>
>> If you think, it's too confusing, maybe, # should be changed to more
>> rarely used symbol like //.
>>
>> 2. # sign is used in pretty formatter:
>> Given I have 5 cukes # A cuke is a cucumber #
>> features/step_definitions/cuke_steps.rb:45
>>
>> Different colors can be used for Gherkin comments and for those special
>> pretty printing comments.
>>
>> So I think those drawbacks can be mitigated and it's possible to have
>> end-of-line comments in Gherkin
>>
>> Just because its technically possible, doesn't mean it should be done.
>

Why do you think so? Are there non-technical drawbacks of end of line
comments?

End of line comments have no place in cucumber features, if your step needs
> a comment to explain something then it needs to be re-written.
>
> Andrew
>
>
>> --
>> -- Rules --
>>
>> 1) Please prefix the subject with [Ruby], [JVM] or [JS].
>> 2) Please use interleaved answers
>> http://en.wikipedia.org/wiki/Posting_style#Interleaved_style
>> 3) If you have a question, don't reply to an existing message. Start a
>> new topic instead.
>>
>> You received this message because you are subscribed to the Google Groups
>> Cukes group. To post to this group, send email to cu...-/***@public.gmane.org<javascript:>.
>> To unsubscribe from this group, send email to
>> cukes+un...-/***@public.gmane.org <javascript:>. For more options, visit this
>> group at https://groups.google.com/d/forum/cukes?hl=en
>>
>>
>>
>
>
>
> --
> ------------------------
> Andrew Premdas
> blog.andrew.premdas.org
>
>

--
-- Rules --

1) Please prefix the subject with [Ruby], [JVM] or [JS].
2) Please use interleaved answers http://en.wikipedia.org/wiki/Posting_style#Interleaved_style
3) If you have a question, don't reply to an existing message. Start a new topic instead.

You received this message because you are subscribed to the Google Groups Cukes group. To post to this group, send email to cukes-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org To unsubscribe from this group, send email to cukes+***@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/cukes?hl=en
Trevor Harmon
2012-11-25 14:22:49 UTC
Permalink
On Nov 25, 2012, at 6:12 AM, Andrey Botalov <botalov.andrey-***@public.gmane.org> wrote:

> Just because its technically possible, doesn't mean it should be done.
>
> Why do you think so? Are there non-technical drawbacks of end of line comments?

A comment is a plain-English description of something, but Cucumber steps are already in plain English. If you need plain English to describe plain English, something is probably wrong.

Trevor


--
-- Rules --

1) Please prefix the subject with [Ruby], [JVM] or [JS].
2) Please use interleaved answers http://en.wikipedia.org/wiki/Posting_style#Interleaved_style
3) If you have a question, don't reply to an existing message. Start a new topic instead.

You received this message because you are subscribed to the Google Groups Cukes group. To post to this group, send email to cukes-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org To unsubscribe from this group, send email to cukes+***@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/cukes?hl=en
George Dinwiddie
2012-11-25 17:54:09 UTC
Permalink
Trevor,

On 11/25/12 9:22 AM, Trevor Harmon wrote:
> On Nov 25, 2012, at 6:12 AM, Andrey Botalov <botalov.andrey-***@public.gmane.org
> <mailto:botalov.andrey-***@public.gmane.org>> wrote:
>
>> Just because its technically possible, doesn't mean it should be
>> done.
>>
>>
>> Why do you think so? Are there non-technical drawbacks of end of line
>> comments?
>
> A comment is a plain-English description of something, but Cucumber
> steps are already in plain English. If you need plain English to
> describe plain English, something is probably wrong.

Well said! Perhaps the current step should be replaced with the comment.

- George

--
----------------------------------------------------------------------
* George Dinwiddie * http://blog.gdinwiddie.com
Software Development http://www.idiacomputing.com
Consultant and Coach http://www.agilemaryland.org
----------------------------------------------------------------------

--
-- Rules --

1) Please prefix the subject with [Ruby], [JVM] or [JS].
2) Please use interleaved answers http://en.wikipedia.org/wiki/Posting_style#Interleaved_style
3) If you have a question, don't reply to an existing message. Start a new topic instead.

You received this message because you are subscribed to the Google Groups Cukes group. To post to this group, send email to cukes-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org To unsubscribe from this group, send email to cukes+***@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/cukes?hl=en
Rob Crawford
2012-11-26 03:52:40 UTC
Permalink
What about comments documenting the evolution of the feature? "Changed due
to BUG-1234" or "Corporate wants this behavior"?



On Sun, Nov 25, 2012 at 12:54 PM, George Dinwiddie
<lists-HLNzD44B1AikJOqCEYON2AC/***@public.gmane.org>wrote:

> Trevor,
>
>
> On 11/25/12 9:22 AM, Trevor Harmon wrote:
>
>> On Nov 25, 2012, at 6:12 AM, Andrey Botalov <botalov.andrey-***@public.gmane.org
>> <mailto:***@gmail.**com <botalov.andrey-***@public.gmane.org>>> wrote:
>>
>> Just because its technically possible, doesn't mean it should be
>>> done.
>>>
>>>
>>> Why do you think so? Are there non-technical drawbacks of end of line
>>> comments?
>>>
>>
>> A comment is a plain-English description of something, but Cucumber
>> steps are already in plain English. If you need plain English to
>> describe plain English, something is probably wrong.
>>
>
> Well said! Perhaps the current step should be replaced with the comment.
>
> - George
>
> --
> ------------------------------**------------------------------**
> ----------
> * George Dinwiddie * http://blog.gdinwiddie.com
> Software Development http://www.idiacomputing.com
> Consultant and Coach http://www.agilemaryland.org
> ------------------------------**------------------------------**
> ----------
>
>
> --
> -- Rules --
>
> 1) Please prefix the subject with [Ruby], [JVM] or [JS].
> 2) Please use interleaved answers http://en.wikipedia.org/wiki/**
> Posting_style#Interleaved_**style<http://en.wikipedia.org/wiki/Posting_style#Interleaved_style>
> 3) If you have a question, don't reply to an existing message. Start a new
> topic instead.
>
> You received this message because you are subscribed to the Google Groups
> Cukes group. To post to this group, send email to cukes-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
> To unsubscribe from this group, send email to cukes+unsubscribe@**
> googlegroups.com <cukes%2Bunsubscribe-/***@public.gmane.org>. For more
> options, visit this group at https://groups.google.com/d/**
> forum/cukes?hl=en <https://groups.google.com/d/forum/cukes?hl=en>
>
>
>

--
-- Rules --

1) Please prefix the subject with [Ruby], [JVM] or [JS].
2) Please use interleaved answers http://en.wikipedia.org/wiki/Posting_style#Interleaved_style
3) If you have a question, don't reply to an existing message. Start a new topic instead.

You received this message because you are subscribed to the Google Groups Cukes group. To post to this group, send email to cukes-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org To unsubscribe from this group, send email to cukes+***@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/cukes?hl=en
Rob Park
2012-11-26 04:49:33 UTC
Permalink
On Sun, Nov 25, 2012 at 8:52 PM, Rob Crawford <rob5136-***@public.gmane.org> wrote:

> What about comments documenting the evolution of the feature? "Changed due
> to BUG-1234" or "Corporate wants this behavior"?


IMO, that kind of comment belongs in version control as metadata about a
feature; not in the feature itself.

//rob

>
>
>
> On Sun, Nov 25, 2012 at 12:54 PM, George Dinwiddie <
> lists-HLNzD44B1AikJOqCEYON2AC/***@public.gmane.org> wrote:
>
>> Trevor,
>>
>>
>> On 11/25/12 9:22 AM, Trevor Harmon wrote:
>>
>>> On Nov 25, 2012, at 6:12 AM, Andrey Botalov <botalov.andrey-***@public.gmane.org
>>> <mailto:***@gmail.**com <botalov.andrey-***@public.gmane.org>>> wrote:
>>>
>>> Just because its technically possible, doesn't mean it should be
>>>> done.
>>>>
>>>>
>>>> Why do you think so? Are there non-technical drawbacks of end of line
>>>> comments?
>>>>
>>>
>>> A comment is a plain-English description of something, but Cucumber
>>> steps are already in plain English. If you need plain English to
>>> describe plain English, something is probably wrong.
>>>
>>
>> Well said! Perhaps the current step should be replaced with the comment.
>>
>> - George
>>
>> --
>> ------------------------------**------------------------------**
>> ----------
>> * George Dinwiddie * http://blog.gdinwiddie.com
>> Software Development http://www.idiacomputing.com
>> Consultant and Coach http://www.agilemaryland.org
>> ------------------------------**------------------------------**
>> ----------
>>
>>
>> --
>> -- Rules --
>>
>> 1) Please prefix the subject with [Ruby], [JVM] or [JS].
>> 2) Please use interleaved answers http://en.wikipedia.org/wiki/**
>> Posting_style#Interleaved_**style<http://en.wikipedia.org/wiki/Posting_style#Interleaved_style>
>> 3) If you have a question, don't reply to an existing message. Start a
>> new topic instead.
>>
>> You received this message because you are subscribed to the Google Groups
>> Cukes group. To post to this group, send email to cukes-/***@public.gmane.org.
>> To unsubscribe from this group, send email to cukes+unsubscribe@**
>> googlegroups.com <cukes%2Bunsubscribe-/***@public.gmane.org>. For more
>> options, visit this group at https://groups.google.com/d/**
>> forum/cukes?hl=en <https://groups.google.com/d/forum/cukes?hl=en>
>>
>>
>>
> --
> -- Rules --
>
> 1) Please prefix the subject with [Ruby], [JVM] or [JS].
> 2) Please use interleaved answers
> http://en.wikipedia.org/wiki/Posting_style#Interleaved_style
> 3) If you have a question, don't reply to an existing message. Start a new
> topic instead.
>
> You received this message because you are subscribed to the Google Groups
> Cukes group. To post to this group, send email to cukes-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
> To unsubscribe from this group, send email to
> cukes+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org For more options, visit this group at
> https://groups.google.com/d/forum/cukes?hl=en
>
>
>

--
-- Rules --

1) Please prefix the subject with [Ruby], [JVM] or [JS].
2) Please use interleaved answers http://en.wikipedia.org/wiki/Posting_style#Interleaved_style
3) If you have a question, don't reply to an existing message. Start a new topic instead.

You received this message because you are subscribed to the Google Groups Cukes group. To post to this group, send email to cukes-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org To unsubscribe from this group, send email to cukes+***@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/cukes?hl=en
Trevor Harmon
2012-11-26 06:04:18 UTC
Permalink
You can still put that information in a comment on a line by itself. At the top of the feature, for example. Just not on the same line as a step.

Trevor

On Nov 25, 2012, at 9:52 PM, Rob Crawford <rob5136-***@public.gmane.org> wrote:

> What about comments documenting the evolution of the feature? "Changed due to BUG-1234" or "Corporate wants this behavior"?
>
>
>
> On Sun, Nov 25, 2012 at 12:54 PM, George Dinwiddie <***@idiacomputing.com> wrote:
> Trevor,
>
>
> On 11/25/12 9:22 AM, Trevor Harmon wrote:
> On Nov 25, 2012, at 6:12 AM, Andrey Botalov <botalov.andrey-***@public.gmane.org
> <mailto:botalov.andrey-***@public.gmane.org>> wrote:
>
> Just because its technically possible, doesn't mean it should be
> done.
>
>
> Why do you think so? Are there non-technical drawbacks of end of line
> comments?
>
> A comment is a plain-English description of something, but Cucumber
> steps are already in plain English. If you need plain English to
> describe plain English, something is probably wrong.
>
> Well said! Perhaps the current step should be replaced with the comment.
>
> - George
>
> --
> ----------------------------------------------------------------------
> * George Dinwiddie * http://blog.gdinwiddie.com
> Software Development http://www.idiacomputing.com
> Consultant and Coach http://www.agilemaryland.org
> ----------------------------------------------------------------------
>
>
> --
> -- Rules --
>
> 1) Please prefix the subject with [Ruby], [JVM] or [JS].
> 2) Please use interleaved answers http://en.wikipedia.org/wiki/Posting_style#Interleaved_style
> 3) If you have a question, don't reply to an existing message. Start a new topic instead.
>
> You received this message because you are subscribed to the Google Groups Cukes group. To post to this group, send email to cukes-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org To unsubscribe from this group, send email to cukes+***@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/cukes?hl=en
>
>
>
>
> --
> -- Rules --
>
> 1) Please prefix the subject with [Ruby], [JVM] or [JS].
> 2) Please use interleaved answers http://en.wikipedia.org/wiki/Posting_style#Interleaved_style
> 3) If you have a question, don't reply to an existing message. Start a new topic instead.
>
> You received this message because you are subscribed to the Google Groups Cukes group. To post to this group, send email to cukes-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org To unsubscribe from this group, send email to cukes+***@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/cukes?hl=en
>
>

--
-- Rules --

1) Please prefix the subject with [Ruby], [JVM] or [JS].
2) Please use interleaved answers http://en.wikipedia.org/wiki/Posting_style#Interleaved_style
3) If you have a question, don't reply to an existing message. Start a new topic instead.

You received this message because you are subscribed to the Google Groups Cukes group. To post to this group, send email to cukes-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org To unsubscribe from this group, send email to cukes+***@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/cukes?hl=en
Andrey Botalov
2013-02-19 21:04:57 UTC
Permalink
On Sunday, November 25, 2012 8:54:14 PM UTC+3, George Dinwiddie wrote:

> Trevor,
>
> On 11/25/12 9:22 AM, Trevor Harmon wrote:
> > On Nov 25, 2012, at 6:12 AM, Andrey Botalov <botalov...-***@public.gmane.org<javascript:>
> > <mailto:botalov...-***@public.gmane.org <javascript:>>> wrote:
> >
> >> Just because its technically possible, doesn't mean it should be
> >> done.
> >>
> >>
> >> Why do you think so? Are there non-technical drawbacks of end of line
> >> comments?
> >
> > A comment is a plain-English description of something, but Cucumber
> > steps are already in plain English. If you need plain English to
> > describe plain English, something is probably wrong.
>
> Well said! Perhaps the current step should be replaced with the comment.
>
>
I consider Cucumber a tool for communicating not only between developers
and customers but for communicating between all technical and non-technical
people. At company where I work we use Cucumber for system testing and
communicating between not enough technical testers (that aren't able to
read/write code) and people that actually write step definitions for those
tests.

I wish I could do something like this:

Scenario: Upload profile photo from url
Given I am logged in
When I upload photo from:
| https://upload.wikimedia.org/wikipedia/en/b/bc/Wiki.png
| # PNG at HTTPS
| http://wvs.topleftpixel.com/photos/scotia_plaza_tall_stitched.jpg
| # Tall JPEG
|
https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcQZztyvv826mbBdiJYFzvFEcxGio8Uz03Fx49shHDutOuklYL6A
| # Without extension
| http://chwww1.confidesk.com/img/confidesk_logo_03.png
| # Redirect from HTTP to HTTPS
|
https://static.adzerk.net/Advertisers/fdec4733b4814d9e958b7f86c25020b5.jpg
| # untrusted HTTPS

Those example urls represent issues that were found previously in our
application. I think testers want to see both things:
- example url
- explanation of this test url was chosen

Changing table to something like this:
| utl to PNG at HTTPS |
| url to tall JPEG |
| Url without extension |
| url with redirect from HTTP to HTTPS |
| untrusted HTTPS |

will hide urls with which issues previously occured.

Writing 5 scenarios instead of one outline is unnecessary as all those
examples represent the same use case from business logic point of view.

So currently I do:

Scenario: Upload profile photo from url
# Random url is read from assets/image_urls.yml
Given I am logged in
When I upload photo from random url

But it will be more nicely to put end of line comments to rows in table
instead of using separate file.

- George
>
> --
> ----------------------------------------------------------------------
> * George Dinwiddie * http://blog.gdinwiddie.com
> Software Development http://www.idiacomputing.com
> Consultant and Coach http://www.agilemaryland.org
> ----------------------------------------------------------------------
>
>

--
-- Rules --

1) Please prefix the subject with [Ruby], [JVM] or [JS].
2) Please use interleaved answers http://en.wikipedia.org/wiki/Posting_style#Interleaved_style
3) If you have a question, don't reply to an existing message. Start a new topic instead.

You received this message because you are subscribed to the Google Groups Cukes group. To post to this group, send email to cukes-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org To unsubscribe from this group, send email to cukes+***@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/cukes?hl=en
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
Trevor Harmon
2013-02-19 21:16:24 UTC
Permalink
I think you're using tables for the wrong thing. You should be using Scenario Outlines instead.

Also, you can make the description (e.g. "Tall JPEG") a column in the table. It doesn't need to be a comment outside of the table.

| URL | Description |
| https://upload.wikimedia.org/wikipedia... | PNG at HTTPS |
...

Trevor

On Feb 19, 2013, at 1:04 PM, Andrey Botalov <botalov.andrey-***@public.gmane.org> wrote:

> On Sunday, November 25, 2012 8:54:14 PM UTC+3, George Dinwiddie wrote:
> Trevor,
>
> On 11/25/12 9:22 AM, Trevor Harmon wrote:
> > On Nov 25, 2012, at 6:12 AM, Andrey Botalov <botalov...-***@public.gmane.org
> > <mailto:botalov...-***@public.gmane.org>> wrote:
> >
> >> Just because its technically possible, doesn't mean it should be
> >> done.
> >>
> >>
> >> Why do you think so? Are there non-technical drawbacks of end of line
> >> comments?
> >
> > A comment is a plain-English description of something, but Cucumber
> > steps are already in plain English. If you need plain English to
> > describe plain English, something is probably wrong.
>
> Well said! Perhaps the current step should be replaced with the comment.
>
>
> I consider Cucumber a tool for communicating not only between developers and customers but for communicating between all technical and non-technical people. At company where I work we use Cucumber for system testing and communicating between not enough technical testers (that aren't able to read/write code) and people that actually write step definitions for those tests.
>
> I wish I could do something like this:
>
> Scenario: Upload profile photo from url
> Given I am logged in
> When I upload photo from:
> | https://upload.wikimedia.org/wikipedia/en/b/bc/Wiki.png | # PNG at HTTPS
> | http://wvs.topleftpixel.com/photos/scotia_plaza_tall_stitched.jpg | # Tall JPEG
> | https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcQZztyvv826mbBdiJYFzvFEcxGio8Uz03Fx49shHDutOuklYL6A | # Without extension
> | http://chwww1.confidesk.com/img/confidesk_logo_03.png | # Redirect from HTTP to HTTPS
> | https://static.adzerk.net/Advertisers/fdec4733b4814d9e958b7f86c25020b5.jpg | # untrusted HTTPS
>
> Those example urls represent issues that were found previously in our application. I think testers want to see both things:
> - example url
> - explanation of this test url was chosen
>
> Changing table to something like this:
> | utl to PNG at HTTPS |
> | url to tall JPEG |
> | Url without extension |
> | url with redirect from HTTP to HTTPS |
> | untrusted HTTPS |
>
> will hide urls with which issues previously occured.
>
> Writing 5 scenarios instead of one outline is unnecessary as all those examples represent the same use case from business logic point of view.
>
> So currently I do:
>
> Scenario: Upload profile photo from url
> # Random url is read from assets/image_urls.yml
> Given I am logged in
> When I upload photo from random url
>
> But it will be more nicely to put end of line comments to rows in table instead of using separate file.
>
> - George
>
> --
> ----------------------------------------------------------------------
> * George Dinwiddie * http://blog.gdinwiddie.com
> Software Development http://www.idiacomputing.com
> Consultant and Coach http://www.agilemaryland.org
> ----------------------------------------------------------------------
>
>
> --
> -- Rules --
>
> 1) Please prefix the subject with [Ruby], [JVM] or [JS].
> 2) Please use interleaved answers http://en.wikipedia.org/wiki/Posting_style#Interleaved_style
> 3) If you have a question, don't reply to an existing message. Start a new topic instead.
>
> You received this message because you are subscribed to the Google Groups Cukes group. To post to this group, send email to cukes-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org To unsubscribe from this group, send email to cukes+***@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/cukes?hl=en
> ---
> You received this message because you are subscribed to the Google Groups "Cukes" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to cukes+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

--
-- Rules --

1) Please prefix the subject with [Ruby], [JVM] or [JS].
2) Please use interleaved answers http://en.wikipedia.org/wiki/Posting_style#Interleaved_style
3) If you have a question, don't reply to an existing message. Start a new topic instead.

You received this message because you are subscribed to the Google Groups Cukes group. To post to this group, send email to cukes-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org To unsubscribe from this group, send email to cukes+***@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/cukes?hl=en
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
Andrey Botalov
2013-02-19 21:40:46 UTC
Permalink
On Wed, Feb 20, 2013 at 12:16 AM, Trevor Harmon <trevor-ebqu8CYYB8DQT0dZR+***@public.gmane.org> wrote:

> I think you're using tables for the wrong thing. You should be using
> Scenario Outlines instead.
>
> Also, you can make the description (e.g. "Tall JPEG") a column in the
> table. It doesn't need to be a comment outside of the table.
>
> | URL |
> Description |
> | https://upload.wikimedia.org/wikipedia... | PNG at HTTPS |
> ...
>
>
Yes, I can use column instead of comment but comments feel more natural as
Descriptions won't be used in step definitions.

Trevor
>
> On Feb 19, 2013, at 1:04 PM, Andrey Botalov <botalov.andrey-***@public.gmane.org>
> wrote:
>
> On Sunday, November 25, 2012 8:54:14 PM UTC+3, George Dinwiddie wrote:
>
>> Trevor,
>>
>> On 11/25/12 9:22 AM, Trevor Harmon wrote:
>> > On Nov 25, 2012, at 6:12 AM, Andrey Botalov <botalov...-***@public.gmane.org
>> > <mailto:***@gmail.**com>> wrote:
>> >
>> >> Just because its technically possible, doesn't mean it should be
>> >> done.
>> >>
>> >>
>> >> Why do you think so? Are there non-technical drawbacks of end of line
>> >> comments?
>> >
>> > A comment is a plain-English description of something, but Cucumber
>> > steps are already in plain English. If you need plain English to
>> > describe plain English, something is probably wrong.
>>
>> Well said! Perhaps the current step should be replaced with the comment.
>>
>>
> I consider Cucumber a tool for communicating not only between developers
> and customers but for communicating between all technical and non-technical
> people. At company where I work we use Cucumber for system testing and
> communicating between not enough technical testers (that aren't able to
> read/write code) and people that actually write step definitions for those
> tests.
>
> I wish I could do something like this:
>
> Scenario: Upload profile photo from url
> Given I am logged in
> When I upload photo from:
> | https://upload.wikimedia.org/wikipedia/en/b/bc/Wiki.png
> | # PNG at HTTPS
> | http://wvs.topleftpixel.com/photos/scotia_plaza_tall_stitched.jpg
> | # Tall JPEG
> |
> https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcQZztyvv826mbBdiJYFzvFEcxGio8Uz03Fx49shHDutOuklYL6A| # Without extension
> | http://chwww1.confidesk.com/img/confidesk_logo_03.png
> | # Redirect from HTTP to HTTPS
> |
> https://static.adzerk.net/Advertisers/fdec4733b4814d9e958b7f86c25020b5.jpg| # untrusted HTTPS
>
> Those example urls represent issues that were found previously in our
> application. I think testers want to see both things:
> - example url
> - explanation of this test url was chosen
>
> Changing table to something like this:
> | utl to PNG at HTTPS |
> | url to tall JPEG |
> | Url without extension |
> | url with redirect from HTTP to HTTPS |
> | untrusted HTTPS |
>
> will hide urls with which issues previously occured.
>
> Writing 5 scenarios instead of one outline is unnecessary as all those
> examples represent the same use case from business logic point of view.
>
> So currently I do:
>
> Scenario: Upload profile photo from url
> # Random url is read from assets/image_urls.yml
> Given I am logged in
> When I upload photo from random url
>
> But it will be more nicely to put end of line comments to rows in table
> instead of using separate file.
>
> - George
>>
>> --
>> ------------------------------**------------------------------**----------
>>
>> * George Dinwiddie * http://blog.gdinwiddie.com
>> Software Development http://www.idiacomputing.com
>> Consultant and Coach http://www.agilemaryland.org
>> ------------------------------**------------------------------**----------
>>
>>
>>
> --
> -- Rules --
>
> 1) Please prefix the subject with [Ruby], [JVM] or [JS].
> 2) Please use interleaved answers
> http://en.wikipedia.org/wiki/Posting_style#Interleaved_style
> 3) If you have a question, don't reply to an existing message. Start a new
> topic instead.
>
> You received this message because you are subscribed to the Google Groups
> Cukes group. To post to this group, send email to cukes-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
> To unsubscribe from this group, send email to
> cukes+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org For more options, visit this group at
> https://groups.google.com/d/forum/cukes?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Cukes" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to cukes+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
>
> --
> -- Rules --
>
> 1) Please prefix the subject with [Ruby], [JVM] or [JS].
> 2) Please use interleaved answers
> http://en.wikipedia.org/wiki/Posting_style#Interleaved_style
> 3) If you have a question, don't reply to an existing message. Start a new
> topic instead.
>
> You received this message because you are subscribed to the Google Groups
> Cukes group. To post to this group, send email to cukes-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
> To unsubscribe from this group, send email to
> cukes+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org For more options, visit this group at
> https://groups.google.com/d/forum/cukes?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Cukes" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to cukes+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

--
-- Rules --

1) Please prefix the subject with [Ruby], [JVM] or [JS].
2) Please use interleaved answers http://en.wikipedia.org/wiki/Posting_style#Interleaved_style
3) If you have a question, don't reply to an existing message. Start a new topic instead.

You received this message because you are subscribed to the Google Groups Cukes group. To post to this group, send email to cukes-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org To unsubscribe from this group, send email to cukes+***@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/cukes?hl=en
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
George Dinwiddie
2013-02-20 03:10:29 UTC
Permalink
Andrey

On 2/19/13 4:40 PM, Andrey Botalov wrote:
> On Wed, Feb 20, 2013 at 12:16 AM, Trevor Harmon <trevor-ebqu8CYYB8DQT0dZR+***@public.gmane.org
> <mailto:trevor-ebqu8CYYB8DQT0dZR+***@public.gmane.org>> wrote:
>
> I think you're using tables for the wrong thing. You should be using
> Scenario Outlines instead.
>
> Also, you can make the description (e.g. "Tall JPEG") a column in
> the table. It doesn't need to be a comment outside of the table.
>
> | URL
> | Description |
> | https://upload.wikimedia.org/wikipedia... | PNG at HTTPS |
> ...
>
>
> Yes, I can use column instead of comment but comments feel more natural
> as Descriptions won't be used in step definitions.

Nor will they be parsed as part of the step. Gherkin is not Ruby. The
'#' character has no special significance in gherkin. Nor does the
comment character from any other programming language.

- George

--
----------------------------------------------------------------------
* George Dinwiddie * http://blog.gdinwiddie.com
Software Development http://www.idiacomputing.com
Consultant and Coach http://www.agilemaryland.org
----------------------------------------------------------------------

--
-- Rules --

1) Please prefix the subject with [Ruby], [JVM] or [JS].
2) Please use interleaved answers http://en.wikipedia.org/wiki/Posting_style#Interleaved_style
3) If you have a question, don't reply to an existing message. Start a new topic instead.

You received this message because you are subscribed to the Google Groups Cukes group. To post to this group, send email to cukes-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org To unsubscribe from this group, send email to cukes+***@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/cukes?hl=en
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
Trevor Harmon
2013-02-20 03:18:52 UTC
Permalink
On Feb 19, 2013, at 7:10 PM, George Dinwiddie <lists-D547HKeqtWSkJOqCEYON2AC/***@public.gmane.org> wrote:

> The '#' character has no special significance in gherkin. Nor does the comment character from any other programming language.

I think that was his point. The URL description is not to be processed by the step; therefore he does not want to pass it to the step as data. He wants it completely ignored, like a comment.

Trevor

--
-- Rules --

1) Please prefix the subject with [Ruby], [JVM] or [JS].
2) Please use interleaved answers http://en.wikipedia.org/wiki/Posting_style#Interleaved_style
3) If you have a question, don't reply to an existing message. Start a new topic instead.

You received this message because you are subscribed to the Google Groups Cukes group. To post to this group, send email to cukes-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org To unsubscribe from this group, send email to cukes+***@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/cukes?hl=en
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
George Dinwiddie
2013-02-20 03:26:09 UTC
Permalink
Trevor,

On 2/19/13 10:18 PM, Trevor Harmon wrote:
> On Feb 19, 2013, at 7:10 PM, George Dinwiddie <lists-D547HKeqtWSkJOqCEYON2AC/***@public.gmane.org> wrote:
>
>> The '#' character has no special significance in gherkin. Nor does
>> the comment character from any other programming language.
>
> I think that was his point. The URL description is not to be
> processed by the step; therefore he does not want to pass it to the
> step as data. He wants it completely ignored, like a comment.

My point is that if embedded '#' characters start getting treated as
comment delimiters, then it will no longer be gherkin. And then we will
need some sort of escape character to be able to use '#' in steps.

- George

--
----------------------------------------------------------------------
* George Dinwiddie * http://blog.gdinwiddie.com
Software Development http://www.idiacomputing.com
Consultant and Coach http://www.agilemaryland.org
----------------------------------------------------------------------

--
-- Rules --

1) Please prefix the subject with [Ruby], [JVM] or [JS].
2) Please use interleaved answers http://en.wikipedia.org/wiki/Posting_style#Interleaved_style
3) If you have a question, don't reply to an existing message. Start a new topic instead.

You received this message because you are subscribed to the Google Groups Cukes group. To post to this group, send email to cukes-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org To unsubscribe from this group, send email to cukes+***@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/cukes?hl=en
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
aslak hellesoy
2012-11-01 09:25:16 UTC
Permalink
On Thu, Nov 1, 2012 at 4:45 AM, Trevor Harmon <trevor-ebqu8CYYB8DQT0dZR+***@public.gmane.org> wrote:

> I agree that Cucumber statements should be as literate as possible, but
> there are always situations where a little commentary can save time.
>
> In my situation, I am trying to simulate the user choosing options from a
> lunch menu. There are many different restaurants, and each restaurant has
> its own menu, but they are all presented as a series of options: e.g.,
> "Choose your soup type", "Choose your noodle type", "Choose your
> vegetable". For this scenario, the particular restaurant and menu
> selections are unimportant; I simply need to drill down through some series
> of options to complete the order.
>
> I have a custom step defined as "I touch list item number (\d+)" that
> selects the menu option at the given index.
>
> And here is a snippet of the code:
>
> And I touch list item number 2 # House of Thai Restaurant
> And I touch list item number 1 # Slice of Beef Noodle Soup
> And I touch list item number 1 # Choose your Noodles
> And I touch list item number 1 # Flat Rice Noodle
> And I touch list item number 3 # Spinach or Watercress
> And I touch list item number 1 # Spinach
>
>
What George said. And what's more - when a user is presented with this UI -
how does he/she know that item 2 is House of Thai if that text is not in
the UI?
Instead of describing UI interaction, try to describe intention. See my
blog post for background:

http://aslakhellesoy.com/post/11055981222/the-training-wheels-came-off


> I suppose I could define a new step like "I touch menu option (.*)" and
> then rewrite the scenario as:
>
> ...
> And I touch menu option "Flat Rice Noodle"
> And I touch menu option "Spinach"
>
> But creating an entirely new step just to make this one scenario a little
> more readable seems like more trouble than it was worth. Or would that be
> the Cucumber way?
>
> Trevor
>
> On Wednesday, October 31, 2012 1:44:29 PM UTC-7, George Dinwiddie wrote:
>>
>> Trevor,
>>
>> On 10/31/12 4:03 PM, Trevor Harmon wrote:
>> > I want to be able to do:
>> >
>> > |
>> > Feature: foo
>> > Scenario: bar
>> > Given baz # This is a comment
>> > |
>> >
>> > and have Cucumber ignore "This is a comment".
>> >
>> > But instead Cucumber thinks the comment is part of the step!
>>
>> Yes, Cucumber accepts all characters in a gherkin statement.
>>
>> > |
>> > Given /^baz \# This is a comment$/ do
>> > pending # express the regexp above with the code you wish you had
>> > end
>> > |
>> >
>> > Am I doing something wrong, or is this a bug?
>>
>> You're doing something wrong. :-) Your "Given" line should be
>> self-explanatory, and shouldn't need a comment. It's not code. It's as
>> close to the natural language of the business as possible. The word
>> "baz" just doesn't communicate enough.
>>
>> Can you show the real thing? Perhaps we can help you reword the step to
>> incorporate the comment.
>>
>> - George
>>
>>
>> --
>> ------------------------------**------------------------------**----------
>>
>> * George Dinwiddie * http://blog.gdinwiddie.com
>> Software Development http://www.idiacomputing.com
>> Consultant and Coach http://www.agilemaryland.org
>> ------------------------------**------------------------------**----------
>>
>>
>> --
> -- Rules --
>
> 1) Please prefix the subject with [Ruby], [JVM] or [JS].
> 2) Please use interleaved answers
> http://en.wikipedia.org/wiki/Posting_style#Interleaved_style
> 3) If you have a question, don't reply to an existing message. Start a new
> topic instead.
>
> You received this message because you are subscribed to the Google Groups
> Cukes group. To post to this group, send email to cukes-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
> To unsubscribe from this group, send email to
> cukes+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org For more options, visit this group at
> https://groups.google.com/d/forum/cukes?hl=en
>
>
>

--
-- Rules --

1) Please prefix the subject with [Ruby], [JVM] or [JS].
2) Please use interleaved answers http://en.wikipedia.org/wiki/Posting_style#Interleaved_style
3) If you have a question, don't reply to an existing message. Start a new topic instead.

You received this message because you are subscribed to the Google Groups Cukes group. To post to this group, send email to cukes-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org To unsubscribe from this group, send email to cukes+***@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/cukes?hl=en
Continue reading on narkive:
Loading...