How to write a response of each test in the collection to a file

How to write a response of each test in the collection to a file?