How to add some external links to ROBOT Framework Test Statistics in log.html and output.xml?

Question:

How can I customize my robot framework log.html and output so that I can add some external links to my output files like log.html and output.xml file.

Asked By: pankmish

||

Answers:

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:

*** Settings ***
Metadata   Here is a link    http://www.external.com/pages.html

And that will be included in your output.xml and report.html

Answered By: Laurent Bristiel

There are several ways to add links to a robot framework log. They are all documented in the Robot framework users guide.

Adding links to tags

You can add links to tags with the –tagstatlink option. 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:%[email protected]?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. 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.

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.

Answered By: Bryan Oakley

You want to add top-level metadata.
And that metadata would be an HTML link.

Create a suit setup for the master suite (create a file called __init__.robot in
the parent test folder)

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

Answered By: Uri Shtand

thank so good the is a good
Documentation The main init phase for all robot framework tests.
Suite Setup Setup

Answered By: habib hoseni
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.