Forum Discussion

rajs2020's avatar
Frequent Contributor
4 years ago

ReadyAPI - How to log all the inputs and outputs in proper order ?

I have a test case which has only run test steps. These steps run "function tests" which can have REST & SOAP api calls, Groovy scripts and also SQL  queries. Function tests meaning test cases which ...
  • nmrao's avatar
    4 years ago
    Another way I can think of to get this done using the following approach.

    1. No parallel tests or not sure how it is going to behave.
    2. All the requests and responses logged into single text file as per Original Post.
    3. This works better for the test steps of Request type.
    4. I believe there won't be much of input / output for Groovy Script steps. And not sure it will trigger the events we are going to use.

    1. Use Events feature in order to achieve this. So that no changes are needed to the test cases.
    2. Set a project level property, say REQUEST_RESPONSE_FILE, and set the absolute file path. This is where all the desired requests and responses will be written in append mode. Be aware that it can go bigger and bigger if the number of tests are growing.
    3. SubmitListener.beforeSubmit => to write requests into the above defined file.
    4. SubmitListener.afterSubmit => to write response into the same file.
    Of course, one need to extract the contents of request and responses and add them to file. I guess it is fairly simple logic to do so in each of the above listener method.

    The above uses events, it can work better to write things in the same order as the events are happening.