Search code examples
pythoncucumberbddlettuce

How to have multiline step definitions calling other multiline step definitions


Attempting to call a multiline step definition from another multiline step definition. The lettuce.py website has little to say on the matter.

@step( u'I create a "([^"]*)" with the definition:$' )
    def i_create_a_resource_with_the_definition( step, resource ):
        body = ""

        if step.multiline != "":
            definition = json.loads( step.multiline )
            body = json.dumps( definition )

        url = world.url + "/" + resource + "s"

        world.response = world.perform_http_request( url = url, method = "POST", body = body )

@step( u'I create a duplicate "([^"]*)" with the definition:$' )
    def i_create_a_duplicate_resource_with_the_definition( step, resource ):
        step.behave_as( """
            I create a "{resource}" with the definition:
        """.format( resource = resource ) )

Solution

  • This issue is product related.

    This should be fixed in the infoxchange/new-parser branch. -- Danielle Madeley