Skip to content
This repository has been archived by the owner on May 28, 2019. It is now read-only.

Multiline in examples tables #52

Closed
teintinu opened this issue Jul 15, 2015 · 5 comments
Closed

Multiline in examples tables #52

teintinu opened this issue Jul 15, 2015 · 5 comments

Comments

@teintinu
Copy link

Scenario: [case]
    Given I need to transpile
    When EcmaScript6=[EcmaScript6]
    Then EcmaScript5=[EcmaScript5]

Examples:
  case             | EcmaScript6              | EcmaScript5
  --------------------------------------------------------------------------------
  arrow function   | var r=arr.map((x)=>x*x); | "use strict";
                   |                          |
                   |                          | var r=arr.map(
                   |                          |   function(x){
                   |                          |     return x*x;
                   |                          | });
  --------------------------------------------------------------------------------
  template strings | var s=`x=${x}            | var s='x='.concat(x).concat('\n')
                   | y=${y}`;                 | .concat('y=').concat(y);

Why:

  • It's very useful
  • Simple to parse, just use a blank or a dashed line before each example.

Note:

  • Identation it's important
  • Allow one or more empty lines between rows for pretty code
  • Sample working here
@aslakhellesoy
Copy link
Contributor

Cucumber and Gherkin is designed to bridge the communication gap between non-technical and technical people by providing a syntax that is easy for non-technical people to learn.

It seems you want to use it more as a scripting tool. Adding code to Gherkin is not a good example of how it is intended to be used. No non-technical person would understand this.

It's the first time I've come across this feature request, so I'm not convinced it's something that more people would find useful - especially not non-technical people.

@mattwynne
Copy link
Contributor

I disagree Aslak - I think this is a really cool use of Cucumber. We want to use it to write executable specifications - why not executable specifications of technical tools too?

I also like the way the tables look without the preceding column separator.

@riaan53
Copy link

riaan53 commented Jul 16, 2015

+1

@aslakhellesoy
Copy link
Contributor

I'd be happy to consider a pull request for this. No amount of +1 will persuade me to do it for you though ;-)

@jenisys
Copy link

jenisys commented Apr 6, 2016

Mmh, for me it easier to read if you would put the different cases into 2 scenarios where the when/then steps have text parts. I think that is much easier to read (and understand) than long multiline rows in table (especially in your example).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants