【问题标题】:Why my "before_tag" functions is not executed by "behave"为什么我的“before_tag”函数不是由“behave”执行的
【发布时间】:2021-08-13 18:00:31
【问题描述】:

我尝试使用行为before_tag 回调。 但 is 似乎从未被调用过。

所以我尝试将任何其他 before_XXX 函数放在我的 environment.py 文件中:

def before_all(context):
    raise ValueError("Here we are")

def before_scenario(context, scenario):
    raise ValueError("Here we are")

def before_step(context, step):
    raise ValueError("Here we are")

但是步骤仍然毫无例外地执行。

在同一个 python 文件中插入无效语法会导致“Exception SyntaxError”,它由行为解释。

您知道我可以做些什么来确定我的使用问题吗? (我目前正在使用行为 1.2.6)

【问题讨论】:

    标签: python bdd python-behave


    【解决方案1】:

    感谢在 python 中部署的行为代码;我可以使用 python 调试器进行调查: environment.py 应存放在当前目录中。

    我将它存储在一个名为 steps 的子目录中,靠近我的其他 python 文件。 我现在可以将固定装置附加到标签上!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-09-02
      • 2020-05-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-11-20
      相关资源
      最近更新 更多