简体   繁体   English

如何在log.html和output.xml中向ROBOT Framework测试统计信息添加一些外部链接?

[英]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框架用户指南》中

Adding links to tags 向标签添加链接

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. 《机器人框架用户指南》中标题为从标记名称创建链接的部分中对此进行了说明。

Adding links via log statements 通过日志语句添加链接

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. 信息记录在《机器人框架用户指南》中标题为“ 记录信息”的部分中。

Adding links via free test suite metadata 通过免费的测试套件元数据添加链接

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关键字。

Adding links in documentation 在文档中添加链接

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.

相关问题 有没有办法在机器人框架中测试完成后在电子邮件中发送log.html,report.html和output.xml? - Is there a way to send log.html,report.html and output.xml in email after test completion in robot-framework? 当测试失败时,机器人框架在log.html内没有输出 - Robot framework no output inside log.html when tests fail 如何从 Robot Framework 输出更改 output.xml 的结构 - How to change the structure of output.xml from Robot Framework output 机器人框架中的output.xml文件是如何生成的 - How is the output.xml file generated in robot framework Python不会登录Robot框架log.html - Python doesn't log into Robot framework log.html 在 Robot Framework 中的 Suite Teardown 之前解析 output.xml - Parse output.xml before Suite Teardown in Robot Framework 通过 Rebot 模型在机器人框架中生成两个 log.html 文件时出错 - error while generating two log.html files in robot framework by Rebot model Allure 无法读取由机器人框架中的 AllureReportLibrary 生成的 output.xml 文件 - Allure not able to read output.xml file generated by AllureReportLibrary in Robot Framework 像机器人关键字一样将 Python 函数记录到 log.html - Logging Python function to log.html like robot keywords 如何在 Robot-Framework report.html 上添加指向套件元数据的内部链接? - How to add internal links to Suite Metadata on Robot-Framework report.html?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM