问题
Using Karate i am making API calls sequentially. I need to store API request and response for this sequential flow of APIs in separate text files for each API call. Need to understand how can i achieve this.
I have tried logback which stores entire execution logs in a text file.
回答1:
Take a look at karate.prevRequest which will give you the "request". Now use some custom Java (or JS) code and write whatever you want to a file.
I think personally it is un-necessary because Karate's HTML report has all that you need. If someone is asking you to do this, please try convince that person that this exercise is a waste of time.
来源:https://stackoverflow.com/questions/57474109/how-to-store-logs-for-every-api-call-in-a-separate-text-file