我想了解机器人中异常处理的方式。我想使用某种通用方法来处理多个测试用例中的异常。
答案 0 :(得分:0)
您可以为此使用以下两个关键字:
运行关键字并继续失败
根据您的要求运行关键字并忽略错误,但是我建议选择第二个,因为这样您就可以存储输出和状态
答案 1 :(得分:0)
例如,您可以定义一个Test Teardown关键字。就我而言(网络自动化解决方案),会发生以下情况:
# Following closes potential alert and saves what the alert says
${message} = Run Keyword And Ignore Error Handle Alert timeout=0s
# This is a keyword that empties download/upload directories and saves their content for future debugging
Save Artefacts uploadDir=${global_uploadDir} downloadDir=${global_downloadDir} outputDir=${global_outputDir} testStatus=${TEST STATUS}
# This keyword just captures a screenshot in case that test failed
Run Keyword If Test Failed Capture Page Screenshot