Skip to content

Parsers should parse scenario outline like standard scenarios #409

@dcendents

Description

@dcendents

Hi,

  • I use cfparse when I want to parse a list.
  • I use scenario outlines when I want to test my scenario with different values

I cannot mix both conditions together.

e.g.:

Scenario Outline: mix case
  Given the emails <emails>
  ...

Examples:
  | emails |
  | someone@somewhere.com |
  | someone@somewhere.com, someone.else@somewhere.com |


Scenario: other scenario
  Given the emails email1@server.net, email2@server.net
  ...

It would be very useful if I could then have the following step

@given(parsers.cfparse("Given the emails {emails:str+}". extra_types=dict(str=str)), target_fixture="emails")
def emails(emails)
    return emails

Ok I could split the list myself, but it's ugly

@given("Given the emails <emails>")
@given(parsers.cfparse("Given the emails {emails:str+}". extra_types=dict(str=str)), target_fixture="emails")
def emails(emails)
    return emails if isinstance(emails, list) else emails.split(",")

The same kind of support has been asked a few times in #293 but since it has nothing to do with the original problem I fear it has been lost through all the discussions.

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions