How can I take screenshots of failed testcases in Jenkins pipeline?

How to take screenshots of failed testcases in Katalon, but save them in Jenkins? When saved, how exactly do I open them? A further helpful thing would be to know how to create a ticket in Jira when a testcase fails and attach the screenshot with the fail message.

I have tried WebUI.screenschot(path) but I did not know which exact path to give for Jenkins, nor how to extract the Screenshot.

Thank you very much for your help!

1 Like

Hi,

Welcome to Katalon Community.

Can you please try this WebUI.takeScreenshot(path): [WebUI] Take Screenshot | Katalon Docs. With the path location, you can refer to: Ralative path for screenshot in Jenkins stores file in installation directory to set the relative path with integration in Jenkins.

In terms of ticket, I will need to ask help from my team whether it can be done. Back to you soon.

1 Like

I don’t know if it will work in Jenkins, but the screenshots will go where you indicate in the “path” parameter, such as below. I save the screenshots under my Reports folder and each Test Suite will have its own as well. KS will make the folder if it does not already exist.

gReportPathway = ".\\Reports\\Screenshots\\RT WP 012\\"

and in your code, you would add a filename to your screenshot; in this case, “Authors1.png”.

WebUI.takeScreenshot(gReportPathway + "Authors1.png")

If you have a somewhat larger web page, there is also:

WebUI.takeFullPageScreenshot(gReportPathway + "Authors2.png")