need to change exception message. How to Change Exception Message in TestNG Report and change this Exception message into correct error message 此报告使用不同的 TestNG 报告代码。
使用此代码。,给出链接.. 关联: http://www.seleniumeasy.com/testng-tutorials/testng-customize-emailable-html-report-example
最佳答案
您可以使用 Try Catch 机制自定义有意义的消息
您可以在其中使用 try{} block 和 catch(Exception e){} 构造代码,如果您保留堆栈跟踪,则只有它会检索如图所示的默认异常消息。
喜欢:
try {
"Your Code" ;
}
catch(Exception e) {
System.out.println("Custom User defined message");
e.printStackTrace();
}
如果不使用 e.printStackTrace() 跟踪异常;那么它将仅检索控制台中的用户定义消息以及 TestNG 报告。
关于java - 如何更改 TestNG 报告中的异常消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50851075/