How to Store response in a file?

Hoe can I automatically store response header and body in a file as a log for a test case? (I use Katalon in command line mode)

I do not think Katalon Studio supports automatically storing response and body in a file.

You need to write test case codes to write data into files for yourself.

Getting JSON body from the HTTP response is easy, writing a JSON into a file is also easy.

But it is not very easy to resolve paths for files appropriately for logging purpose.

I have just posted another tips:

This post presents an external java library named Materials. The Materials library makes it easy to resolve output file path in a well structured format like:

${projectDir}/Materials/${testSuiteName}/${testSuiteTimestamp}/${testCaseName}/${subdirs}/${fileName}

for example

./Materials/TS07_visit_a_web_site/20180919_132138/TC07_visit_a_web_site/1 CURA_Homepage.png

This format of path includes a directory layer of Timestamp . This makes it easy to store files chronologically just like Katalon’s Reports. It would be best suited for logging purpose.

I have written another post

I believe I have developed a useful tool for logging HTTP Response Header and Bodies.

2 Likes