I have published a GitHub project
Background
In the Katalon User Forum, there is a Frequently Asked Question.
I want to do a Web UI test using browsers and at the same time I want to save the payload of HTTP requests and responses into a file. How can I do it?
Katalon Studio v8.5.x does not support recording the payload of HTTP messages exchanged between a web browser and HTTP servers. You need to employ an additional technology. The following post by matteo.lauria at Feb '21 suggested BrowserMob Proxy for this purpose.
BrowserMob Proxy will enable us to make a HAR file which contains all HTTP requests and responses recorded during tests in Katalon Studio. The HTTP messages will be formated in JSON.
The post suggested the way how to make use of BrowserMob Proxy in Katalon Studio. Unfortunately the presented sample codes were not complete (e.g, the import
statements were trimmed off), so it was a bit difficult to reuse on your machine.
What’s this
Here I would show you a runnable Katalon Studio project empowered by BrowserMob Proxy which makes a HAR file that contain HTTP messages exchanged by browser and HTTP servers.
You can download the zip of the project from the Releases page. You want to download the zip; unzip it; open the project with your local Katalon Studio; run the “Test Suite/TS1”; when it finished you will find sample.har
file is created in the project folder.
How to view
The sample.har
file will be a very large JSON text file. It is difficult to see it and grasp overall in a text editor. You would need a tailored viewer for HAR file. I use Visual Studio Code with HAR Viewer plugin installed. The following image shows an example:
Hope this helps.