Try Catch Report Issue in Katalon

Hi I have noticed the below issue in reporting of Katalon :

A test case is marked as failed in report generated in ‘Reports folder’ even when the failing step exception in thrown in try and caught in catch block successfully.

Steps to Replicate :

  1. Create a object ‘ABC’ with a random locator.
  2. Add below script in your test case :

try {
WebUI.click(findTestObject(‘ABC’)) //This will fail as locator is wrong
}catch(Exception ex) {
WebUI.delay(5)
}

Run this test case.It is passing which is expected since I have caught the exception using try catch.

  1. Add this test case in a test suite.Run that test suite.

Note the logs,the test case is passing.

  1. Go to reports folder.Locate the report generated.

Notice the same execution of the above test case is marked a failed with try step shown as a failure for reason.

PFA screenshot :

Please help me in resolving this.

Regards,
Kunal Shokeen

try catch issue.png

Hi Kunal,

I’ve added a ticket for this. In the meanwhile you should add Failure Handling value to that ‘Click’ keyword, so it should be this:

try {

WebUI.click(findTestObject(‘ABC’),FailureHandling.OPTIONAL) //This will fail as locator is wrong

}catch(Exception ex) {

WebUI.delay(5)

}

This will mark ‘Click’ step as a Warning status in case the actual result of this step is FAILED, so that both generated report and Log Viewer will have the same statuses.

1 Like

Hi Vinh,

Thanks for your suggestion.

However, using Optional will not execute catch part of the try catch block when try throws a warning instead of failure.

What i want to achieve is when something fails catch the exception and execute the catch block and mark test as pass.

By when it will be fixed ?:slight_smile:

Thanks !

Also, forgot to add why catch is not executing when a test step in try block throws a warning ?!

Thanks

Ah I see. It will be fixed in our next release . By the way, this is just an issue with showing the incorrect result in ‘Log Viewer’. Actually the correct status is FAILED and it is correctly displayed in HTML report, so you can use that HTML report

Thanks Vinh.

So,as a workaround till the new release ,we can use ‘Optional’ failure handling in a test step, to mark it as a warning in case of it’s failure and mark the test case as pass.I am right with this ?

In brief,I want to pass the test case in case a test step fails.

Thanks

Also,when we are expecting the new release :slight_smile:

Hi there,

This issue will be fixed in our next release 5.4. We want to make sure both Test Suite’s report and Log Viewer have the same status for this fix.

Regards

3 Likes

Hello,

My test steps are present within a try catch block. When i generate the test suite report, the PDF report does not provide detailed steps inside the try catch block. It only mentions that the try /catch block is executed and passed. Are we not specifying step details inside PDF report

1 Like