'Running a Python + Behave automation project and trying to execute steps inside another steps

@step(u'Child step')
def login_to_something(context):
    context.execute_steps(u'parent step 1')
    context.execute_steps(u'parent step 2') 

It is unable execute_steps as mentioned above for parent step 1 and it throws the following error:- "behave.parser.ParserError: Failed to parse "



Solution 1:[1]

When the Behave engine is not able to identify or distinguish the steps within a step, probably the error you see. Then there is something probably not in semantic as expected by engine.

I got your point, yes the preposition should not matter and just the step is good enough.. But there is something missing in expected semantic so the parser error.

 def login_to_something(context):
    context.execute_steps('''
        when write the step 1 here
        then write the step 2 here
    '''
    )

I'm unable to get from more information shared by you in problem statement.

Solution 2:[2]

Check the Indentations of your feature file. We also faced this issues multiple times.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 Dranzer