1

need to change exception message.How to Change Exception Message in TestNG Report and change this Exception message into correct error message this report using different code for TestNG report.

Using This Code., Link Given.. Link: http://www.seleniumeasy.com/testng-tutorials/testng-customize-emailable-html-report-example

  • the link is to change time format in the html not for the message. Your message is correct. – Murthi Jun 14 '18 at 06:42
  • Possible duplicate of [How to customize Selenium TestNG default report or create new HTML report?](https://stackoverflow.com/questions/39654254/how-to-customize-selenium-testng-default-report-or-create-new-html-report) – Rcordoval Jun 14 '18 at 07:16

1 Answers1

1

You can customize it with meaningful Message, By using Try Catch mechanism

Where you can construct code with try{} block and in catch(Exception e){} if you keep stack trace then only it will retrieve default Exception message as Shown.

Like:

try {
   "Your Code" ;
} 
catch(Exception e) {
     System.out.println("Custom User defined message");
     e.printStackTrace();
}

If you don't trace Exception with e.printStackTrace(); then it will retrieve only your user define message in Console as well as TestNG Report.

Ishita Shah
  • 3,955
  • 2
  • 27
  • 51