Forum Discussion

rajs2020's avatar
rajs2020
Frequent Contributor
3 years ago
Solved

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.

5 Replies

  • nmrao's avatar
    nmrao
    Champion Level 3
    Is it possible to show how it is currently and how it is expected?

    Use a sample project so that would help to reproduce and verify after any possible solution? Project can be created on SoapUI instead of ReadyAPI as this can be useful for open source users too.
  • nmrao's avatar
    nmrao
    Champion Level 3
    I just remember, when the tests are executed with testrunner utility, the text file is being created for request and responses of each step and the file name contains the suite_case_step_status. But it is long ago.
    I guess one needs to provide the location to store all the files. Can't recall the details now.
    Have you tried executing the tests command line ?
  • nmrao's avatar
    nmrao
    Champion Level 3
    By the way, do you run the tests in parallel? in that case, what order ?
  • RusselViola's avatar
    RusselViola
    SmartBear Alumni (Retired)

    Hey rajs2020 ,

    I think the easiest way to do this would be to utilize the Data-Sink test step inside the individual test cases. You can output any properties/values you want in an iterative fashion using that. And there's a variety of output methods including excel or csv. You can even hook these up as SubReports to your larger test case report with a little effort.

    ~Russel


  • nmrao's avatar
    nmrao
    Champion Level 3
    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.