简体   繁体   English

如何在机器人框架中获取错误消息?

[英]How to get the error message in robot framework?

I have created a script to get the error output 我创建了一个脚本来获取错误输出

***Settings***
Resource           importsLib.robot
Suite Setup     Run Keywords
...             Initialize Test     AND
...             Register Keyword To Run On Failure    Failure Callback
Variables       OMG.yaml

and the keywords 和关键字

***Keywords***
Failure Callback
     Capture Page Screenshot
     Log Source    loglevel=WARN

but the point is I need to get HTML error message when Back-end didn't send the value to Front-end element sometimes and I need to track the root causes of faults or problems. 但是关键是当后端没有有时将值发送到前端元素时,我需要获取HTML错误消息,并且我需要跟踪故障或问题的根本原因。

Can you offer the best solution for this case? 您能为这种情况提供最佳解决方案吗?

You can use HttpLibrary but you should also code BE tests for it, there is no way to check it under your FE tests if you are not check parallelly BE http methods. 您可以使用HttpLibrary,但也应该为其编写BE测试代码,如果不并行检查BE http方法,则无法在FE测试下对其进行检查。

You can create your own custom libraries or keywords for it. 您可以为其创建自己的自定义库或关键字。

And here is a example of how you can use custom libraries on the Robot Framework : How to create a custom Python code library for the Robot Framework 以下是如何在Robot Framework上使用自定义库的示例: 如何为 Robot Framework 创建自定义Python代码库

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM