¿Hay alguna forma de obtener el error / excepción completa usando ITestResult en el Método posterior?
@Test(priority = 16, enabled = true)
public void C2410859_FilterAlertsByCard()
throws IOException, InterruptedException, ATUTestRecorderException, APIException {
record.start();
launchUrl();
startResult();
startTestCase(Thread.currentThread().getStackTrace()[1].getMethodName().toString());
LoginApplication(username, password);
HomePage homePage = new HomePage();
homePage.MyAlerts.click();
MyAlerts myalerts = new MyAlerts();
}
@AfterMethod
public void afterMethod(ITestResult result) throws ATUTestRecorderException {
resultOfTest(result);
endTestcase();
endResult();
record.stop();
closeBrowsers();
}
resultOfTest:
public static void resultOfTest(ITestResult result) {
try
{
if(result.getStatus() == ITestResult.SUCCESS)
{
//Do something here
System.out.println("passed **********");
}
else if(result.getStatus() == ITestResult.FAILURE)
{
//Do something here
System.out.println("Failed ***********");
test.fail("This test is failed due to "+ result.getThrowable());
}
else if(result.getStatus() == ITestResult.SKIP ){
System.out.println("Skiped***********");
}
}
catch(Exception e)
{
e.printStackTrace();
}
}
Esto solo muestra un error de línea (p. Ej., Excepción de puntero nulo). ¿Hay alguna manera de obtener el error / excepción completa usando ITestResult en el Método posterior?