Screenshot on failure name

Hi there.

Does someone know if it is possible to change the name of the screenshot automatically taken when a Test Case fails?
I’m currently developing a custom Keyword that makes a request to post into xRay the evidences, but the name that katalon gives to the screenshots makes no sense to me so and I can’t determine to which Test Case it belongs.

Any sugestions?

Thanks a lot.

With the built in functionality, no, I don’t believe there is. However…

If you have control of the error, you can take your own screenshot and provide a path and name for the file.

Alternatively, you could rename the screenshots that Katalon is saving – not sure this would benefit you though since the existing names don’t make sense to you.

Also, give this a look:

Hi @Russ_Thomas

Thanks for your response.
Is there any file where I can check what Katalon does to take the screenshot using the built in functionality?
Is it a listener or something?
Maybe I can make my own listener and apply what you are saying to it.


That’s the basic idea, yes. It doesn’t need to be a listener - depends on how you approach the problem/solution. It seems you want to capture the error state in afterTextCase(). There may be some cases where that doesn’t work - not sure - it’s been a while since I played around in there.

What you could try is to wrap your test cases in a try-catch to ensure you’re grabbing every test failure. This is the way I work. The only errors that method fails to detect, are fundamental failures (failure to compile, etc.) so it works pretty good for actual test case steps:

//imports ...

try {

  // test case steps
  // ...

} catch(Exception e) {
  // screenshot code

Of course, if you have 500 tests, you have a fair bit of work ahead of you going this route. But it will give you precisely what you want - control over every test case failure.

Notice also, you’re leaving Katalon to pick up the error too (you’re not eating it). So Katalon’s normal behavior at the point of the failure remains intact.

1 Like

Oh thank you so much!
I already have a lot of test cases so I’ll ask my team which solution works better for them (I have my suspicions…) but that helped a lot.

Thanks for your time!

1 Like