Skip to content

Invalid HTML generated by org.testng.reporters.jq.SuitePanel#generateMethod #199

Closed
atomicknight opened this Issue Mar 23, 2012 · 0 comments

1 participant

@atomicknight

Line 86 in SuitePanel adds the message from a Throwable to the generated HTML output without escaping reserved characters, which causes rendering issues when such characters are present in the message. For example, given this test:

package com.example;

public class Test {
    @org.testng.annotations.Test
    public void test1( ) { org.testng.Assert.assertFalse( true ); }
}

The generated output is:

<b>"expected:<false> but was:<true>"</b>

However, the correct output should be:

<b>"expected:&lt;false> but was:&lt;true>"</b>

The naive fix would probably look something like this:

          .append(tr.getThrowable().getMessage().replace("&","&amp;").replace("<","&lt;")

But this should probably be generalized into a utility class or the like. commons-lang provides HTML escaping features that may be useful as inspiration for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.