testng icon indicating copy to clipboard operation
testng copied to clipboard

HTML Colours are not getting reflected in the report in TestNG 6.8 release

Open Ramnathan opened this issue 13 years ago • 13 comments

When we give HTMLcode in the Reporter.Log function, generally that particular colour will be reflected for whatever we have given in the HTML report we get, till TestNG 6.7 release but the color is not getting applied from TestNG 6.8 releases. We get some weird error messages if we give the HTML Color code. This is an important aspect which helps to filter the log report(emailable report) with different colours

Ramnathan avatar Apr 22 '13 07:04 Ramnathan

Do you see the problem with 6.8.1 as well? If you do, can you give some details?

cbeust avatar Apr 22 '13 14:04 cbeust

Yes the issue persists in 6.8.1 also ..

Actually if we give a code "Reporter.log(""+message+"");", we lll get the message in red color but it does not happen in 6.8 releases. it just prints the contents present in the reporter.log function instead of printing it in red....."Font Color tag given inside the reporter.log method "

Ramnathan avatar Apr 24 '13 12:04 Ramnathan

Can anybody plz provide a solution for this?.....it does play an important role I would say :)

Ramnathan avatar Apr 25 '13 10:04 Ramnathan

cbeust : Can you plz look into the issue specified above and come up with a solution ?

Ramnathan avatar Jul 10 '13 12:07 Ramnathan

@cbeust I am also facing the same issue..The html tags are getting escaped in the report and is coming as a raw text output. For Example:Reporter.log("PASS"); Output: PASS, but i wanted in Green color..

Operating System Used is: Windows 7

saikiran40cs avatar Aug 06 '15 09:08 saikiran40cs

@cbeust I am trying to insert a screenshot link to emailable report. Below is my code Reporter.setEscapeHtml(false); Reporter.log("<a href = "screenshot_filepath"><font color='red'>Link</font></a>" ); It is giving the red link in index.html, but in emailable report, it is printing the plain text Can you pls provide me a solution for this? TestNG: 6.9.9

Vijayalakshmi01 avatar Aug 10 '16 05:08 Vijayalakshmi01

Hi, Anyone has found a solution for tags getting escaped. I have tried all the possible things mentioned in the internet. But no luck.. Output is getting displayed as below: [a href="C:/2016.12.01.23.03.59.jpg"] [img src="C:/2016.12.01.23.03.59.jpg"/] [/a]

1.ReportNG reports are generating properly 2. I have set the escape property as System.setProperty("org.uncommons.reportng.escape-output", "false") 3. I disabled the default listeners from project properties. 4. I added reportng listeners to testng.xml and pom.xml.

Not sure why the screenshots are not getting displayed. Please anyone suggest.

karthiknvss avatar Dec 02 '16 23:12 karthiknvss

Hi @cbeust : Escaping is not getting turned off in emailable report html . Please fix asap Thanks

mmtmohit avatar Dec 05 '16 14:12 mmtmohit

@mmtmohit - I am not able to reproduce this problem using TestNG 6.10. It would be good if you could please help furnish a reproducible test that can be used to recreate the problem if you feel that the issue still exists when using TestNG 6.10

Here's what my test class looks like

import org.testng.Reporter;
import org.testng.annotations.Test;

import java.io.File;

public class SimulateIssue {
    @Test
    public void testMethod() {
        Reporter.setEscapeHtml(false);
        Reporter.log("<a href='http://www.google.com'><font color='red'>Open Google</font></a>", true);
        String currentDir = "file://" + new File(System.getProperty("user.dir")).getAbsolutePath() + File.separator + "pom"
            + ".xml";
        Reporter.log("<a href='" + currentDir + "'><font color='green'>View Pom file</font></a>", true);

    }
}

Here are the screenshots from the generated reports

Emailable-Report

375-1

Default TestNG report (index.html)

375-2

krmahadevan avatar Dec 11 '16 05:12 krmahadevan

@mmtmohit With testNG 6.10, i am not able to reproduce the issue. Date of release for testNG 6.10 is (Dec 06, 2016).

Use the below link to know the latest testNG releases. https://mvnrepository.com/artifact/org.testng/testng/

I suggest to use the maven dependencies in your project so that you will not face this issues in future.

saikiran40cs avatar Dec 16 '16 08:12 saikiran40cs

Looks fixed in 6.10 Feel free to reopen if it is not the case.

juherr avatar Dec 16 '16 12:12 juherr

Hi all,

I would like to generate the output with different colors at testng reports.

I am using the following syntax, but not working.

"Reporter.log("<font color='red'> Hello world </font>");

Desired output is Hello world in red color, but actual output is <font color='red'> Hello world </font>.

I am using testng 6.10. Please let me know if anything else we need do

sravee123 avatar Dec 07 '17 10:12 sravee123

@sravee123 - Please open a new issue, include all the details and you can cross reference this issue in the new one.

krmahadevan avatar Dec 13 '17 13:12 krmahadevan