rajs2020
4 years agoFrequent Contributor
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 are disabled and used as utility functions. I would like to be able to view the inputs and outputs of each of the test steps in proper order, all in one document (MS word or text). It would be nice if the XML & JSON could be pretty formatted too. Can I do this easily with ReadyAPI? How?
I need it so that I understand a big test at a quick glance. The ReadyAPI debugger is slow and confusing, so I want to avoid using it.
- Another way I can think of to get this done using the following approach.
Assumptions:
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.
Approach:
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.