首页 > 解决方案 > Robotframework - 有没有办法用“不应该包含”检查价值并在失败时继续?

问题描述

我正在从命令生成输出,我想在继续之前检查潜在的 4 个错误

例子

不应包含 ${output} error1 msg=你有错误 1

不应包含 ${output} error2 msg=you have error 2

不应包含 ${output} error3 msg=you have error 3

不应包含 ${output} error4 msg=you have error 4

目前,当 error1 与 true 匹配时,函数失败并中止,也就是致命错误,我希望它继续运行,即使遇到错误 1,也可能出现错误 3 或更多,也就是我希望它“失败”而不是“致命错误”

有什么办法吗?/也许可以使用其他方法?

标签: robotframeworkbuilt-in

解决方案


这些关键字之一应该是您需要的:

运行关键字并在失败时继续

运行关键字并返回状态

示例 1

Run Keyword And Continue On Failure  should not contain   ${output}   error1 msg=you have error 1

示例 2

${status}  Run Keyword And Return Status  should not contain   ${output}   error1 msg=you have error 1

推荐阅读