You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Using HTML in failure messages is not possible in setups/teardowns or with continuable failures #2360
Triggering the Fail keyword during Test Teardown causes the *HTML* markup to fail - it is rendered literally.
Steps to Reproduce
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.
Set the Test Teardown value to call this keyword.
Create a test case that does something simple, but which will not set the case state to Fail.
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>
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.
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
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.
Activity
pekkaklarck commentedon Apr 28, 2016
This problem is caused by the added
Teardown failedprefix 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 onlyFAIL.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.
GLMeece commentedon Apr 28, 2016
FWIW, the Jenkins Robot Framework plugin somehow renders this correctly if you zoom in on a test case which has resulted in an error:

[-]`Fail` keyword test teardown assertion causes *HTML* to fail[/-][+]Using HTML in failure messages is not possible in setups/teardowns or with continuable failures[/+]pekkaklarck commentedon Jul 5, 2016
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.