RE: How to ignore a tastcase which fails and start executing further on a same TESTSUIT

Hello All,
I have a Test-suit contain 100 testcases.
Now if suppose my 5 testcase fail then it jump to exception block and my testsuit stop executing for further testcases of same testsuit.
Is there is any way that even if any testcase fails and jump to exception block then TestNG ignore that testcase and start executing further Test cases of respective Testsuit.

shubham Train Asked on September 16, 2014 in Selenium WebDriver.
Add Comment
4 Answers

Hi Shubham,

There can be many ways of doing that and it all depends how you handle the situation in your framework. But the best you can do is to catch the exception in your main test case, then fail the test case (print log , print error, take sreenshot or anything). So you are just eating the exception but still logging it in the logs and all the required steps for a error.

//Your Test Case code
          // If in case you got any exception during the test, it will mark your test as Fail in the test result sheet
          // If the exception is in between the test, bcoz of any element not found or anything, this will take a screen shot
          // This will print the error log message

You need to do this exception handing in each of your test case.

Best Regards,
Lakshay Sharma

Professor Answered on September 17, 2014.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.