How do I log the request and response in soapUI?

12,869

When you create a setup and/or teardown script, remember those are run only once per run, not per test! What you intended is not going to work.

In your setup, since no tests have run yet, the context is going to be empty ... as you can see from your log message.

In your teardown, I suspect there is a bug in SoapUI and the log is not getting sent to the log tab. If you intentionally create an error (I used logg.info "Hello world!" - note the intentional double g), I still got a an error in the error log tab.

Share:
12,869
abhi
Author by

abhi

I am a passionate developer who's well versed in a few technologies and always learning new ones. I have been coding (GW-BASIC) since 8th Grade. I am currently developing on the Salesforce Platform. I am also dabbling with angularJs with the objective of replacing the ASP .NET MVC architecture with an HTML5.0 - AngularJS- WebApi architecture. I have used the simple-salesforce library and Python to create test scripts for my salesforce org.

Updated on June 04, 2022

Comments

  • abhi
    abhi almost 2 years

    I am calling a REST based service from SoapUI. I have created a load test for the service and the test works. I wrote the following code in my setup script for the load test.

    log.info("This is from the setup script")
    def request = context.expand('${#Request}')
    log.info(request)
    def response = context.expand('${#Response}')
    log.info(response);
    

    The only item I am getting in my log is the "This is from the setup script". I also added the following lines of code in my Teardown script.

    log.info("Teardown script")
    def response = context.expand('${#Response}')
    log.info(response);
    

    I am not seeing the "Teardown script" text in the log. At this point I am a bit puzzled as to the behavior.

    Load Test: This is my load test

    Test Suite

    This is my test suite

    Test case options. I have unchecked the Discard OK results test box. Test case options

    What changes do I need to do to my scripts in order to log the requests and the responses?