首页 > 解决方案 > 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

即使在任何测试用例中间发生任何故障,也不应该停止的执行。

标签: robotframework

解决方案


Robot Framework 有一些有用的方法:

  1. Run Keyword And Continue On Failure open https://www.morganre.com/
  2. Run Keyword And Ignore Error open https://www.morganre.com/

两者都适合您,但第一个将显示失败的方法并显示失败状态,第二个将忽略错误。

详细信息请参考http://robotframework.org/robotframework/latest/libraries/BuiltIn.html


推荐阅读