如下面的机器人文件所示,我有三个测试用例。如果 TESTCASE1 失败,我想停止测试执行。只有在 TESTCASE1 通过时才应执行 TESTCASE2。
*** Settings ***
Library pythonLib
*** Test cases ***
TESTCASE1
boot device
TESTCASE2
configure device
TESTCASE3
restart device
是否有任何关键字或自定义方法可以做到这一点?
最佳答案
如果您希望机器人在任何测试失败后立即停止运行,则有一个命令行选项。此选项是 --exitonfailure
.来自机器人框架用户指南,在标题为 Stopping when the first test fails 的部分中:
If option
--exitonfailure
is used, test execution stops immediately if any critical test fails. Also the remaining tests are marked as failed.
您可能还想看看 this answer问题 Automatic failing/non-execution of interdependent tests in Robot Framework ,展示了如何编写关键字来实现测试用例之间的依赖关系。
关于robotframework - 如果第一个测试用例失败,如何停止机器人框架测试执行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33319992/