-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
While creating a custom code for html table in emailablereport.html, Multiple <br> tags are getting added #3144
Comments
@jayshreekant - It's not clear what the issue is. Can you please help share a sample project that can be used to reproduce the problem? If the issue is with the default TestNG reporters that come bundled with TestNG, then maybe you could mention the report name and/or the listener class from wherein you think this discrepancy is popping up. |
Hi, @jayshreekant. Please help share a Minimal, Reproducible Example that can be used to recreate the issue. In addition to sharing a sample, please also add the following details:
It would be better if you could share a sample project that can be directly used to reproduce the problem. |
@krmahadevan Kindly execute this code using mvn clean test and Iterate to \DemoMavenProject\target\surefire-reports\emailable-report.html and check how many |
@jayshreekant - The problem lies in your test code. You are basically trying to construct a html table using a series of The Emailable HTML Report was never meant for such sophisticated usecases I believe. You should ideally speaking be building your own reporting solutions. All said and done, the below altered sample test code will ensure that the problem goes away. The code that I am sharing below basically constructs the entire html table as a single string and dumps it as 1 log message (instead of doing it as n log messages which your sample was doing) import org.testng.Reporter;
import org.testng.annotations.Test;
public class ErrorLotOfBreak {
@Test
public void ErrorLotofBreak() {
Reporter.log("Sample Text 1");
Reporter.log("Sample Text 2");
Reporter.log("Sample Text 3");
Reporter.log("Sample Text 4");
Reporter.log("Sample Text 5");
Reporter.log(buildTable());
}
private static String buildTable() {
return "<table><th>Age/Priority</th><th>URL</th><th>Count ()</th><th>Status</th>" +
"<tr>" +
"<td>" + "Ram" + "</td>" +
"<td>" + "Shyam" + "</td>" +
"<td>" + "Dheeraj" + "</td>" +
"<td>" + " Alert " + "</td>" +
"</tr>" +
"<tr>" +
"<td>" + "Ram" + "</td>" +
"<td>" + "Shyam" + "</td>" +
"<td>" + "Dheeraj" + "</td>" +
"<td>" + " Alert " + "</td>" +
"</tr>" +
"<tr>" +
"<td>" + "Ram" + "</td>" +
"<td>" + "Shyam" + "</td>" +
"<td>" + "Dheeraj" + "</td>" +
"<td>" + " Alert " + "</td>" +
"</tr>" +
"<tr>" +
"<td>" + "Ram" + "</td>" +
"<td>" + "Shyam" + "</td>" +
"<td>" + "Dheeraj" + "</td>" +
"<td>" + " Alert " + "</td>" +
"</tr>" +
"<tr>" +
"<td>" + "Ram" + "</td>" +
"<td>" + "Shyam" + "</td>" +
"<td>" + "Dheeraj" + "</td>" +
"<td>" + " Alert " + "</td>" +
"</tr>" +
"</table>";
}
} Am closing this issue as question answered, since there's not much that can be done from TestNG side in this case. |
TestNG Version
Expected behavior
Should not add
tag, until explicitly mentioned in the Reporter Log
Actual behavior
While creating a custom code for table in emailablereport, Multiple
tags are getting added
Is the issue reproducible on runner?
Test case sample
Contribution guidelines
Incase you plan to raise a pull request to fix this issue, please make sure you refer our Contributing section for detailed set of steps.
The text was updated successfully, but these errors were encountered: