[ResponseObject] Cannot write binary content to file

Katalon’s ResponseObject is designed to process JSON/XML text only. It is not designed to process binary response. See https://github.com/katalon-studio/katalon-studio-testing-framework/blob/master/Include/scripts/groovy/com/kms/katalon/core/testobject/ResponseObject.java getResponseBodyContent()

If you want to download a binary dataf from URL in a Test Case of Katalon Studio, you should write a bit of Groovy script. Let me show you an example. Please make a test case with any name, copy & paste the following snippet, and run it. You will get an image file at <projectDir>/temp/avator.png

import java.nio.file.Files
import java.nio.file.Path
import java.nio.file.Paths

import com.kms.katalon.core.configuration.RunConfiguration

Path projectDir = Paths.get(RunConfiguration.getProjectDir())
Path tmpDir = projectDir.resolve('temp')
Files.createDirectories(tmpDir)
Path output = tmpDir.resolve("avator.png")

URL url = new URL("https://dub2.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/kazurayam/48/333_2.png")

URLConnection connection = url.openConnection()
assert connection != null
println "connection.getContentLength()=" + connection.getContentLength()

InputStream is = new BufferedInputStream(connection.getInputStream())
OutputStream os = new BufferedOutputStream(new FileOutputStream(output.toFile()))

byte[] buffer = new byte[1024]
int n
while ((n = is.read(buffer)) > 0) {
	println "n=" + n
	os.write(buffer, 0, n)
	os.flush()
}

os.close()