robotframework - Robot Framework,即使出现任何故障,如何继续测试用例
问题描述
我是 Robot 的新手,正在学习编写逻辑和测试用例。
我有一个测试套件monitoring.robot,其中有很多测试用例。测试用例如主页web1、主页web2、主页web3...等。如果任何步骤失败,那么执行不应该停止,应该一直持续到事务结束?
监控机器人
Test Case## Heading ##
echo Trans01_WebSites-helloPublicWebsite
open https://www.morganre.com/
assertTitle abcd Group | abcd
echo Trans02_WebSites-CorporateSolutions
open https://corporatesolutions.hello.com/
assertTitle abcd Corporate Solutions
echo Trans03_WebSites-OpenMinds
open https://openminds.hello.com/
assertTitle abcd - Open Minds
echo Trans04_WebSites-Arthello
open http://art.hello.com/
assertTitle Art at abcd
close win_ser_local
Close All Browsers
即使在任何测试用例中间发生任何故障,也不应该停止的执行。
解决方案
Robot Framework 有一些有用的方法:
Run Keyword And Continue On Failure open https://www.morganre.com/
Run Keyword And Ignore Error open https://www.morganre.com/
两者都适合您,但第一个将显示失败的方法并显示失败状态,第二个将忽略错误。
详细信息请参考http://robotframework.org/robotframework/latest/libraries/BuiltIn.html
推荐阅读
- python - 从一个文件复制到新文件时,难以将不同行上的字符串连接到同一行
- sql-server - 在每个增量上生成基于固定长度和数字单位的字符串格式
- python - pipenv 没有在 Pipfile 中安装固定版本的 Django
- amazon-web-services - 通过 API Gateway 将 YAML 有效负载传递给 Lambda 函数
- javascript - 如何找出天蓝色快照何时完成创建
- vb.net - 如何根据游戏内时钟使游戏功能可用?
- webots - 在Webots中模拟高速公路超车场景中揽胜PROTO的指示灯
- javascript - 当我在 Firebase 中找到要获取的数据时如何停止 forEach?
- powershell - 动态移动项目的 Powershell 变量
- python - : 无法连接到 X 服务器 python cv2