gpt4 book ai didi

python-behave - 如何使用 python 在行为中重试失败的场景

转载 作者:行者123 更新时间:2023-12-04 22:58:09 27 4
gpt4 key购买 nike

有人可以告诉我如何使用 Python 在 Behave 中再次运行失败的测试吗?
如果失败,我想自动重新运行失败的测试用例。

最佳答案

行为库实际上有一个 RerunFormatter这可以帮助您重新运行之前测试运行的失败场景。它会创建一个包含所有失败场景的文本文件,例如:

# -- file:rerun.features
# RERUN: Failing scenarios during last test run.
features/auth.feature:10
features/auth.feature:42
features/notifications.feature:67

使用 RerunFormatter您需要做的就是将其放入您的行为配置文件( 行为.ini ):
# -- file:behave.ini
[behave]
format = rerun
outfiles = rerun_failing.features

要重新运行失败的场景,请使用以下命令:
behave @rerun_failing.features

关于python-behave - 如何使用 python 在行为中重试失败的场景,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35571088/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com