How to add new line breaks in assert fail message?

672 views
Skip to first unread message

Jerald paul

unread,
Oct 31, 2011, 7:10:16 AM10/31/11
to testng...@googlegroups.com
Am constructing error message so that it will be shown in the report when there is a exception. For that am using <br> tags but is not working as excpected. it is displayed as such.


Report i got -
java.lang.AssertionError: <br>Error page is not shown for the 1 input aaaaaaaaaaaaaaaaaaaaa<br>Error page is not shown for the 17 input bbbbbbbbbbbbbbbbbbbbbbbbb<br>Error page is not shown for the 35 input cccccccccccccccccc<br>Error page is not shown for the 50 input ddddddddddddddddddddddddddd<br>


I want the message to be displayed each in a new line.

thanks
jerald

Jerald paul

unread,
Oct 31, 2011, 8:01:18 AM10/31/11
to testng...@googlegroups.com
Even i tried this -

Assert.fail("Error Message 1 &lt br &gt Error message 2 ");

still it is displayed in report as

Error Message 1 < br > Error Message 2

what should i have to do to get the error messages as -

Error Message 1
Error Message 2


sabf

unread,
Oct 31, 2011, 9:11:27 AM10/31/11
to testng...@googlegroups.com
try
"Error Message 1 \n Error Message 2"

Jerald paul

unread,
Nov 2, 2011, 7:28:30 AM11/2/11
to testng...@googlegroups.com
I tried this also and is not working. how to add line breaks in error message ?

thomas81

unread,
Nov 3, 2011, 5:28:47 AM11/3/11
to testng-users
I am doing it exactly the way sabf is suggesting. "\n" means "new
line" in Java Strings.

Jerald paul

unread,
Nov 3, 2011, 9:04:41 AM11/3/11
to testng...@googlegroups.com
Very sorry it is working correctly.
Reply all
Reply to author
Forward
0 new messages