Forum Discussion

SuperTester's avatar
SuperTester
Contributor
10 months ago

Error Handling Failed Checkpoints

Hey guys,

 

I'm working on implementing error handling in my automated tests and I was wondering how other testers approach error handling when it comes to their scripts or keyword tests.

 

I want to wrap my automated tests in a try-catch statement where the catch statement will launch a function that will refresh the tested application  to a default state for the next automated test.

 

function test1()
{
try{
*Perform Actions*
Checkpoint()
*Continue Performing Actions*
}
catch(e){
setTestApplicationToDefault()
//continue to test2
}

However, I found a tricky situation. When Test Completes checkpoints fail (regions, File, etc..), they will throw errors. In my mind, a failed checkpoint is not necessarily an error. I would like the automated test to continue to completion and I will examine the test log later.

 

Thanks in advance!

 

1 Reply

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    Since I test a web application and database, in my project settings, I have "continue on error". Each project will restore the database to its original state before the next set of tests are executed.

    I did look into using try...catch, but I decided to take an easy approach and not make the automation complicated.

    You need to understand the difference between exception handling, error handling and event handling.