Skip to content

Using HTML in failure messages is not possible in setups/teardowns or with continuable failures #2360

Closed

Description

@GLMeece

Note: This is related to issue 2358.

Summary

Triggering the Fail keyword during Test Teardown causes the *HTML* markup to fail - it is rendered literally.

Steps to Reproduce

  1. Create a short test suite (example is below) which includes a keyword that sets the test case to Fail status, along with HTML-formatted text.
  2. Set the Test Teardown value to call this keyword.
  3. Create a test case that does something simple, but which will not set the case state to Fail.
  4. Create the keyword that sets the execution value to Fail and include an HTML message.

Example Test Suite

*** Settings ***

Test Teardown       Fail State with Test Message

*** Test Cases ***
Test Fail at Teardown
    [Documentation]    The test case below should resolve to true/pass
    Should Be Equal As Strings    Foo    Foo

*** Keywords ***
Fail State with Test Message
    [Documentation]    The HTML below should be rendered as one would expect,
    ...                however, this bug causes the text to be rendered
    ...                literally in the Message column.
    ...                If it were called as the last step in the test case itself, it would be
    ...                rendered correctly!
    Fail    msg=*HTML* <b>This should be bold!</b> and <i>This should be italic!</i>

Questions?

Activity

  1. pekkaklarck commented on Apr 28, 2016

    @pekkaklarck
    Member

    This problem is caused by the added Teardown failed prefix changing the message so that it doesn't anymore start with the *HTML* marker. It occurs also in setup and with continuable failures if there is more than one failure. It also occurs with all keywords, not only FAIL.

    It ought to be easy to If setup or teardown fails alone. If both test and its teardown fails or if there are multiple failures otherwise, fix requires eacaping non-HTML messages.

  2. added this to the 3.0.1 milestone on Apr 28, 2016
  3. GLMeece commented on Apr 28, 2016

    @GLMeece
    Author

    FWIW, the Jenkins Robot Framework plugin somehow renders this correctly if you zoom in on a test case which has resulted in an error:
    jenkins_plugin_html

  4. changed the title [-]`Fail` keyword test teardown assertion causes *HTML* to fail[/-] [+]Using HTML in failure messages is not possible in setups/teardowns or with continuable failures[/+] on May 31, 2016
  5. pekkaklarck commented on Jul 5, 2016

    @pekkaklarck
    Member

    My guess is that either the Jenkins plugin just always formats text as HTML or uses some kind of algorithm to guess does the text contain HTML or not. In both cases there can be problems if the message contains normal text with HTML or HTML-like syntax that is then rendered incorrectly.

    Good news is that I ought to have this fixed on Robot side now.

  6. self-assigned this
    on Jul 5, 2016
  7. added theissue type on Dec 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions