Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scenario Outline with multiple Examples #1105

Closed
znevrly opened this issue Jun 6, 2018 · 16 comments
Closed

Scenario Outline with multiple Examples #1105

znevrly opened this issue Jun 6, 2018 · 16 comments

Comments

@znevrly
Copy link

znevrly commented Jun 6, 2018

Hi,
first of all, big thanks to have this JS Gherkin implementation.

My issue:
I have Scenario Outline with some Examples. This scenario contains step with getting endpoint with some url and I would like to have another Examples in this Scenario Outline with parameters of url.
Then I want to run scenario according to first Examples multiplied with another Examples. So if first Examples have e.g 4 rows and second 4 rows = 4 x 4 = 16 runs.

Basically the same as
Behat/Behat#1082

@aslakhellesoy
Copy link
Contributor

I’m surprised this doesn’t work already. It definitely does on Java and Ruby....

I agree it should be implemented.

@charlierudolph
Copy link
Member

Behat/Behat#1082 is that only the last examples table gets executed. I consider that separate from multiplying example tables.

Filling out an example. Are you asking for the following:

Scenario Outline:
  Given <a> and <b>
  
  Examples:
    | a  |
    | a1 |
    | a2 |
    | a3 |
    | a4 |

  Examples:
    | b  |
    | b1 |
    | b2 |
    | b3 |
    | b4 |

Where it runs 16 scenarios with the combinations a1/b1, a1/b2, a1/b3, a1/b4, a2/b1, etc. It we were to support such a thing I think we need a different keyword instead of overloading Examples as this setup currently becomes 8 scenarios where in the first 4 b is undefined and in the second 4 a is undefined.

@charlierudolph
Copy link
Member

@aslakhellesoy is multiplying example tables working in java / ruby? Cucucmber-js correctly deals with multiple examples tables for a single scenario outline.

@KyleFairns
Copy link

From what I take from the Behat ticket, what they want to achieve there is not multiplying out the table, but rather grouping examples based on what they express:

    Examples: of ordinary Latin character inputs
      | input |
      | a     |
      | z     |
      | 0     |

    Examples: of Unicode inputs
      | input  |
      | U+0046 |
      | U+0058 |

    Examples: of invalid inputs
      | input  |
      | <      |
      | </     |

Rather than compounding:

    Examples: Usernames
         | username   |
         | admin      |
         | user       |
         | maintainer |
         | moderator  |

    Examples: Passwords
         | password |
         | valid    |
         | invalid  |

I might be wrong though

@aslakhellesoy
Copy link
Contributor

I misread "multiple" Example tables, which works. Multiplying example tables (matrix multiplication?) does not work. I think that would be a bit hard for people to understand.

Have you considered pairwise to generate a smaller table?

@znevrly
Copy link
Author

znevrly commented Jun 21, 2018

Sorry to mislead you by posting Behat ticket. I need exactly what charlierudolph write, even with different keyword.

Thx.

@charlierudolph
Copy link
Member

@znevrly I agree multiplying everything would be confusing when laid against the current examples. I think pairwise is the ideal solution as you can narrow down to a representative set of test cases. @aslakhellesoy do you think we want to build something like pairwise into gherkin? (if we can determine a nice interface)

@aslakhellesoy
Copy link
Contributor

I don't think we should build pairwise into Gherkin - that would be feature creep. I think it's better to use a standalone tool to generate a table, then paste it into a feature file.

@znevrly
Copy link
Author

znevrly commented Jun 21, 2018

That doesn't not sound very comfortable. Any ideas? :)

@aslakhellesoy
Copy link
Contributor

Any ideas about what?

@znevrly
Copy link
Author

znevrly commented Jun 21, 2018

To have some keyword to achieve described behavior (multiplying example tables or matrix multiplication) without need to generate tables manually.

@aslakhellesoy
Copy link
Contributor

Did you realise you only need to run the pairwise tool once to generate a table to paste into a scenario outline? I'm not sure what makes you uncomfortable about that.

@znevrly
Copy link
Author

znevrly commented Jun 22, 2018

But I have dozens feature files with many scenarios. In case of "second" Examples table would be just many copy pasting and it's very clear when is done or not. And in case there will be extra row in "second" Example table I don't need to regenerate all merged tables.

More over with generated tables is not very clear if there are all possible combinations or not. :(

@aslakhellesoy
Copy link
Contributor

We may add a Gherkin pre-processor API at some point. When we do, I think the functionality you’re asking for should be implemented using that API. It’s not a priority at the moment, so if this is urgent to you I suggest you generate Gherkin files yourself.

@Abhishekwalvekar
Copy link

how will i use this in examples - Email should be in the format of "first_name.last_name@company.com"

@SushmaS03
Copy link

Is it possible to Pick only one scenario from the Example table? lets say i have

A| B | C|
| Bundle | 'HD' | 'SHP' |
| PZ | 'HD' | 'SHP' |

If from one feature file(lets say helloWorld.feature) i am calling another feature(Print.feature) file which has scenario outline with above table, then is it possible to pick a scenario to run from the first feature file?

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

No branches or pull requests

6 participants