Setting File Names of Screen Shots

Hello all,

When using the WebUI.takeFullPageScreenshot() tool, is it possible to set the file name for the PNG file or to save PNG files related to each test case in the test suite into their own folders?

I use this feature in my test suite and in multiple tests, however it is hard to distinguish the PNG files when they are upload to DevOps as they are given numeric file names (e.g 1234.png)

Any tips or insight is greatly appreciated.

1 Like

If you mean “their own folders” to be the folders on your local PC, yes, it is possible.
But Katalon provides no support.
Your code is totally responsible for naming and managing the screenshot files.

If you mean “their own folders” on the TestOps environment, I don’t know anything about it.

1 Like

I feel your pain. I agree with you in that the file name like 1234.png for a screenshot image does not help us. A screenshot file named 1234.png without any meta-data looks to be a garbage to me. This problem is fundamental. It requires more of engineering efforts.

I have ever struggled with this problem for years — how to name the screenshot image files, how to identify each PNG files, how to encode META data (which URL each screenshots were taken out of …) together with screenshot images. In the end I have developed a Java library named materialstore

The materialstore provides a sort of object database (like a Git repository) which can store any type of files (any text, any binaries) attached with META data like the URL from which the screenshot was taken out of. It provides a set of API to read/write objects in the database. I use the materialstore to store any screenshot PNG.

On top of the materialstore, I have developed a Java framework named Inspectus, which enables me to build various Selenium-based test projects. I call them “Visual Inspection”.

Using the Inspectus framework, I could build some Katalon test project that performs what I call “Visual Inspection”. See the following post

Here is a sample output created by Inspectus:

demo/store/index.html

The following screenshot shows a section of the output:

In here, you can see that a single screenshot file is named as
CURA/20231210_183212/objects/1b467dc36da1f10c0cd95ac60ab624ef9110c894.jpeg

The path contains

  1. The name CURA of the job that created the image
  2. The timestamp 20231210_183212
  3. The image file has an identifier 1b467dc36da1f10c0cd95ac60ab624ef9110c894 which makes it unique amongst many.

And please note that the materialstore database associates META-data to each individual files: The META-data would be something like:

{"image-height":"1627", "image-width":"1024", "profile":"ProductionEnv", "step":"02", "URL.fragment":"appointment", "URL.host":"katalon-demo-cura.herokuapp.com", "URL.path":"/", "URL.port":"80", "URL.protocol":"https"}

I hope you can guess what these attributes mean. These attributes decorate a screenshot file and make it reusable. The materialstore API enables me to make queries for objects (PNG files) by the META-data.

The Inspectus framework satisfies me. So I do not use the Katalon’s Visual Testing feature.

2 Likes

I wrote a lot above. I could not stop writting it. I wanted to express how much significant I regard @ryan.whyte’s question is.

But I am afraid that my post above would fail to help @ryan.whyte. The materialstore and the Inspectus — these projects of mine are immature, too complicated, poorly documented. Nobody but me would be able to utilize them.

I suppose that @ryan.whyte expected me to give him some smart advices that turn WebUI.takeFullPageScreenshot() and Katalon’s Visual Testing feature more usable.
No, I have no such idea.

1 Like