Cucumber JSON Formatter Scenario Outline id with Example Row number or Example Table Row Data?

518 views
Skip to first unread message

Voke Ransom Anighoro

unread,
Jun 6, 2016, 9:02:23 AM6/6/16
to Cukes
I have been wondering why the JSON formatter for cucumber tends to put scenario outline example table row number rather than the example column data header and the example row data value which is more encompassing and descriptive. We push generated JSON report to a reporting tool called TestRail and this is a right headache when you want to know what exact scenario outline example was executed as you only see a number rather than something descriptive about the scenario outline example. Anyone else having this grind their gears? I have a simple PR i think would help fix this and make it look cleaner. https://github.com/cucumber/cucumber-ruby/pull/985

Thoughts?

Rahul Sharma

unread,
Jun 6, 2016, 9:16:49 AM6/6/16
to Cukes
Hi Voke,

I agree. I have experienced this issue and looked around for a bit. I came across a thread, which requested the data table headers to be substituted in Scenario titles to make it more descriptive and it already exists in Cucumber JAVA and Cucumber JS but not in the ruby version. For example:

Scenario Outline: <user role> is allowed to make changes
   Given I am logged in as <user role>
   Then I should be allowed to make changes
    Examples:
    |user role|
    |admin user|
    |super admin user|

This would then print each outline example as:
admin user is allowed to make changes
super admin user is allowed to make changes

Much more descriptive IMO. But I think Matt Wynne didn't like the idea at the time. 

On Mon, 6 Jun 2016 at 14:02 Voke Ransom Anighoro <ranso...@gmail.com> wrote:
I have been wondering why the JSON formatter for cucumber tends to put scenario outline example table row number rather than the example column data header and the example row data value which is more encompassing and descriptive. We push generated JSON report to a reporting tool called TestRail and this is a right headache when you want to know what exact scenario outline example was executed as you only see a number rather than something descriptive about the scenario outline example. Anyone else having this grind their gears? I have a simple PR i think would help fix this and make it look cleaner. https://github.com/cucumber/cucumber-ruby/pull/985

Thoughts?

--
Posting rules: http://cukes.info/posting-rules.html
---
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+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Björn Rasmusson

unread,
Jun 6, 2016, 2:39:35 PM6/6/16
to Cukes
Cuker wrote:
Hi Voke,

I agree. I have experienced this issue and looked around for a bit. I came across a thread, which requested the data table headers to be substituted in Scenario titles to make it more descriptive and it already exists in Cucumber JAVA and Cucumber JS but not in the ruby version. For example:

Scenario Outline: <user role> is allowed to make changes
   Given I am logged in as <user role>
   Then I should be allowed to make changes
    Examples:
    |user role|
    |admin user|
    |super admin user|

This would then print each outline example as:
admin user is allowed to make changes
super admin user is allowed to make changes

Much more descriptive IMO. But I think Matt Wynne didn't like the idea at the time. 
Hi,

As the new Gherkin compilers include this functionality, it is not to unlikely that it will end up also in Cucumber-Ruby. See also #984.

Regards
Björn
 

Voke Ransom Anighoro

unread,
Jun 6, 2016, 11:51:21 PM6/6/16
to Cukes
That does seem like a simpler solution actually. Does this also reflect in the reports generated using the formatters? 

This doesn't currently work in cucumber-ruby and i bet there will still be a push back to the idea which is why i have gone for the formatter output itself because, using the -x | --expand flag, the pretty output tends to break scenario outlines into individual scenarios using the example table row data as each scenario title which i suppose is unique enough but for some reason this does not extend to the other formatters especially the JSON formatter. For example

Scenario Outline: User with role is allowed to make changes
   Given I am logged in as <user role>
   Then I should be allowed to make changes
    Examples:
    |user role|
    |admin user|
    |super admin user|

Outputs

Scenario Outline: User with role is allowed to make changes
   Given I am logged in as <user role>
   Then I should be allowed to make changes

   Examples:

       Scenario: | admin user |
           Given I am logged in as admin user
           Then I should be allowed to make changes

       Scenario: | super admin user |
           Given I am logged in as super admin user
           Then I should be allowed to make changes

Which is totally acceptable. But when you generate a Json report, then the id tends to replace the example row data with numbers which does not really describe anything
Reply all
Reply to author
Forward
0 new messages