Defining Examples for Multiple Scenario Outlines

In a project where we are using cucumber-jvm for our websites, I ran into a problem that so far I have failed: Se has several Scenario Outline

that should use the same one Examples

. Now, of course, I can copy these examples into each one, but it would be much shorter (and probably easier to understand) if you could do something like this:

    | name  |
    | Alice |
    | Bob   |

Scenario Outline: Flying to the conference
  Given I'm flying to a confernce
  When I try to check in at the airport
  And my name is <name>
  Then I should get my plane ticket

Scenario Outline: Collecting the conference ticket
  Given I'm at a conference
  When I ask for the ticket for <name>
  And show my business card to prove my id
  Then I should get my conference ticket

Scenario Outline: Collectiong my personalized swag bag
  Given I'm at a conference
  When I go to the first booth
  And show them my conference ticket with the name <name>
  Then they'll give me a swag bag with the name <name> printed onto it


Is this possible? If so, how? I would use some kind of factory as suggested here ? If so, any recommendations?


source to share

All Articles