Looking for such a mechanism so that if any exception occurs while executing the test suite it should mark the corresponding test/method as failed.
I am currently working on a project in which I have mainly created scripts for CRUD operations using Page Factory concepts with TestNG Reporting.
I have put the code for all the main test scripts under try…catch block to handle exceptions. After running the test suite I am able to successfully catch the exceptions in eclipse console. But the problem I am facing is “Results of running suite” (TestNG) tab in eclipse shows all the scrips as passed.
I am looking for such a mechanism so that if any exception occurs while executing the test suite it should mark the corresponding test/method as failed in TestNG report.
I tried this. Its working fine in case i want to print my own message like failure occurred in so and so module.
What if i want to print the printStackTrace() (exception error) itself using Assert.assertTrue(false, <message that you want to print>) instead of passing the user defined message to make it more accurate while checking the failure report?.