[英]How to add some external links to ROBOT Framework Test Statistics in log.html and output.xml?
如何自定义机器人框架log.html和输出,以便可以向输出文件(例如log.html和output.xml文件)添加一些外部链接。
You can use metadata in your test suites. 您可以在测试套件中使用元数据。 Those metadata can contains external links.
这些元数据可以包含外部链接。 This is explained in the " Free test suite metadata " section of the User Guide.
用户指南的“ 免费测试套件元数据 ”部分对此进行了说明。
Here is how it looks if you use TXT format for your tests: 如果您使用TXT格式进行测试,则外观如下:
*** Settings ***
Metadata Here is a link http://www.external.com/pages.html
And that will be included in your output.xml and report.html 这将包含在您的output.xml和report.html中
There are several ways to add links to a robot framework log. 有几种方法可以添加指向机器人框架日志的链接。 They are all documented in the Robot framework users guide .
它们全部记录在《 Robot框架用户指南》中 。
You can add links to tags with the --tagstatlink option. 您可以使用--tagstatlink选项将链接添加到标签。 These links will show up in the "statistics by tag" section of the log.
这些链接将显示在日志的“按标签统计”部分中。 Here are the examples from the robot framework user's guide:
以下是机器人框架用户指南中的示例:
--tagstatlink mytag:http://www.google.com:Google
--tagstatlink jython-bug-*:http://bugs.jython.org/issue_%1:Jython-bugs
--tagstatlink owner-*:mailto:%1@domain.com?subject=Acceptance_Tests:Send_Mail
This is documented in the section titled Creating links from tag names in the robot framework users guide. 《机器人框架用户指南》中标题为从标记名称创建链接的部分中对此进行了说明。
You can add any HTML you want by using the special log level HTML
. 您可以使用特殊的日志级别
HTML
添加所需的任何HTML
。 For example: 例如:
*** Test Cases ***
| Example
| | log | For more information see <a href='...'>foo</a> | HTML
This is documented in the section titled Logging information in the robot framework users guide. 该信息记录在《机器人框架用户指南》中标题为“ 记录信息”的部分中。
You can add links in the free test suite metadata. 您可以在免费的测试套件元数据中添加链接。 For example:
例如:
*** Settings ***
| Metadata | More Info
| ... | For more informationabout *Robot Framework* see http://robotframework.org
This is documented in the section titled Free test suite metadata in the robot framework users guide. 《机器人框架用户指南》中标题为“ 免费测试套件元数据 ”的部分对此进行了记录。
You can also call the Set Suite Metadata keyword from anywhere in a test case or keyword. 您还可以在测试用例或关键字中的任何位置调用Set Suite Metadata关键字。
You can add links in test suite, test case, and keyword documentation. 您可以在测试套件,测试用例和关键字文档中添加链接。 This is the example from the users guide:
这是用户指南中的示例:
*** Test cases ***
| Example
| | [Documentation]
| | ... | See [http://www.robotframework.org]|robot framework website]
This is documented in the section titled Custom links and images in the robot framework users guide. 该信息记录在《机器人框架用户指南》中标题为“ 自定义链接和图像 ”的部分中。
You want to add top-level metadata. 您要添加顶级元数据。 And that metadata would be an HTML link.
该元数据将是一个HTML链接。
Create a suit setup for the master suite (create a file called __init__.robot in the parent test folder) 为主套件创建一个西装设置(在父测试文件夹中创建一个名为__init __。robot的文件)
And in it: 在其中:
*** Settings *** Documentation The main init phase for all robot framework tests. Suite Setup Setup *** Keywords *** Setup Set Suite Metadata Link to my cool external site http://www.external.com top=True
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.