cancel
Showing results for 
Search instead for 
Did you mean: 

Output Response time via groovy

Highlighted
Super Contributor

Output Response time via groovy

How can capture the response time via groovy for some test request.

Thanks

Ali
11 REPLIES 11
Highlighted
Super Contributor

Re: Output Response time via groovy

Hi Ali,

easiest is probably

log.info "Time taken" + testRunner.testCase.testSteps["Request 1"].response.timeTaken

does that work ok?

/Ole
eviware.com
Highlighted
Super Contributor

Re: Output Response time via groovy

Ole,
I am getting the following error

Fri Nov 07 11:57:57 PST 2008:ERROR:groovy.lang.MissingPropertyException: No such property: response for class: com.eviware.soapui.impl.wsdl.teststeps.WsdlTestRequestStep
Highlighted
Super Contributor

Re: Output Response time via groovy

Hi!

sorry, I make this mistake all the time.. it should have been

log.info "Time taken" + testRunner.testCase.testSteps["Request 1"].testRequest.response.timeTaken

Hope that works better..

regards!

/Ole
eviware.com
Highlighted
Super Contributor

Re: Output Response time via groovy

can you also tell me how to output the size of the response.

Thanks

Ali
Highlighted
Super Contributor

Re: Output Response time via groovy

Hi!

sure, use the contentLength property

def size = testRunner.testCase.testSteps["Request 1"].testRequest.response.contentLength
...

regards,

/Ole
eviware.com
Highlighted
Contributor

Re: Output Response time via groovy

hey guys, how do I go about outputting the byte size of the response?
Highlighted

Re: Output Response time via groovy

Hi!

Try getting get the size of the entire response with

log.info "Full Response size (in bytes) " + testRunner.testCase.testSteps["Request 1"].testRequest.response.rawResponseData.length

regards,

/Ole
eviware.com

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️Please mark my answer as a solution if it was helpful
Highlighted
Contributor

Re: Output Response time via groovy

Thanks for this Ole. It seems to work. Just wondering, if you have an opinion on what is happening when I save the response to a file.

The response size in soap is :160307 bytes
The response size once saved to file is 169KB

Any idea on the size discrepancy?

Cheers,
- Richard
Highlighted

Re: Output Response time via groovy

The size discrepancy most likely arises due to the way that your operating system saves files to the disk, as well as the way it reports the sizes.

/Nenad
http://eviware.com

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️Please mark my answer as a solution if it was helpful
New Here?
Join us and watch the welcome video:
Announcements
Script Wanted
Check out this week's challenge!

Create a script to generate an email when an assertion fails for the TechCorner tag!


Scripts created in July:
- A script to change the request body before sending it to the server