Exception details using TestNG listener [ IReporter ]

541 views
Skip to first unread message

jeevan s

unread,
Jan 12, 2015, 5:30:04 AM1/12/15
to testng...@googlegroups.com
Hi all ,

We are trying to get the exception details from TestNG listeners . I am right now using IReporter for getting the details of the test , but I am Not able to get the Exception details .

Is it possible to get Exception details using ITestListener or can this be acheived using IReporter ?????

SUBRAMANYESWARA RAO BHAVIRISETTY

unread,
Jan 12, 2015, 1:57:39 PM1/12/15
to testng-users
Hi Jeevan,

  You have to use ITestListener.

Below link from Mrunal gives you more details:

https://groups.google.com/d/msg/testng-users/sWGyEMhe0hw/IjSqSOEcwzEJ

>>>>>>

Hi Sachin
You can do one thing Implement ITestListener class. Implement onTestFailure message as shown. At the end when you have got all the necessary information from the throwable object, you can set the result to (1) based on your condition which will make the test pass if you wish to.

@Override
public void onTestFailure(ITestResult result)
{
// TODO Auto-generated method stub
System.out.println("Test Failed.");
System.out.println(result.getThrowable());
result.getThrowable().getStackTrace();
result.getThrowable().getMessage();
result.setStatus(1);
}





--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to testng-users...@googlegroups.com.
To post to this group, send email to testng...@googlegroups.com.
Visit this group at http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.



--
Subramanyam
Reply all
Reply to author
Forward
0 new messages