Ashish Ahuja
Ashish Ahuja

Reputation: 85

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 "

Upvotes: 1

Views: 1240

Answers (2)

Dranzer
Dranzer

Reputation: 1

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

Upvotes: 0

Ravi Suriya
Ravi Suriya

Reputation: 21

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.

Upvotes: 2

Related Questions