【发布时间】:2022-09-27 21:43:18
【问题描述】:
我如何重用来自 common_step.py 的步骤 例子:
共同特征:
给定使用 \"abc\" 用户登录
common_step:
@given(\'用\"{user}\"用户\'登录)
anotherFile_feature
使用 \"xyz\" 用户登录
另一个文件步骤:
我如何在这里传递那个 xyz 用户,我可以举个例子吗
谢谢
标签: python-behave
我如何重用来自 common_step.py 的步骤 例子:
共同特征:
给定使用 \"abc\" 用户登录
common_step:
@given(\'用\"{user}\"用户\'登录)
anotherFile_feature
使用 \"xyz\" 用户登录
另一个文件步骤:
我如何在这里传递那个 xyz 用户,我可以举个例子吗
谢谢
标签: python-behave
如果您需要在其他步骤或部分代码中重用用户,您不应该将用户的值分配给变量吗?
@given('log in with "{user}" user')
def do_login(context, user)
context.user = user # the context variable will be accessible during execution time
【讨论】: