首页 > 解决方案 > 运行 Python + Behave 自动化项目并尝试在其他步骤中执行步骤

问题描述

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

如上所述,它无法执行父步骤 1,它会引发以下错误:-“behave.parser.ParserError: Failed to parse”

标签: pythonautomation

解决方案


当 Behave 引擎无法识别或区分步骤中的步骤时,可能是您看到的错误。然后有一些东西可能不是引擎所期望的语义。

我明白了你的意思,是的,介词应该无关紧要,只要一步就足够了。但是在预期的语义中缺少一些东西,所以解析器错误。

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

我无法从您在问题陈述中分享的更多信息中获得信息。


推荐阅读