How to handle failed script

Hi Virender/All,

In any case if test script gets failed how to handle this situation means how to take care of script failure handler.

Add Comment
2 Answer(s)

Hi Ravi,

This is a very subjective question here, you can handle script failure in lot of ways. I cannot give you code for this as it is very specific to what you want to achieve.

– Usually your script failure handler is either event driven or is a part of the Test runner.
– You can handle the failure by reporting it first and then marking it for a rerun.
– If you are using testng as your framework, you may want to tap in the ITestListener interface of TestNg. It has two methods, OntestFaliure and OnTestSkipped. You can write the code to take action son failure and skip in these methods.

Virender

Virender Singh Professor Answered on April 24, 2015.
Add Comment

That`s correct Virender,

If the script gets failed then we are required to perform the following :

1. Report the failure script
2. call the handler
3. once framework executed as a whole then rerun the framework for failed scripts as a whole again

Could you pass the code or any help on point 1 & 2.

raviiichauhan85 Train Answered on April 24, 2015.
Add Comment

Your Answer

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