0

is it possible to use *args like step arguments in pytest-bdd?

For example my Scenario:

Scenario: Data Creation
    Given login with USER1 and role ADMIN
    Then set expert portal mode
    Then fill section Name with Alexa
    Then fill section Phonenumbers with 490000000,490000001
    Then fill section Kontakt with admin@yahoo.com,AdminName,490000002

Step Implementation:

@then(parsers.parse("fill section {section_name} with {fill_data}"))
def fill_section(app, section_name, fill_data):
    app.siptrunk.fill_section(section_name, fill_data)

And implementation:

def fill_section(self, section, *args):
 ...some code...

How can I process *args in "Step Implementation" to correctly pass parameters into function?

Kisuro
  • 104
  • 7
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Feb 03 '22 at 14:56

1 Answers1

0

I think it's not possibile to use *args, it's possible to use list as step argument, but for parsing you need to use: cfparse

@then(parsers.cfparse("fill section {section_name} with {fill_data:Number+}", extra_types={"Number": int}))
    def fill_section(app, section_name, fill_data):
        type(fill_data)   # <class 'list'>