How i can save only limited (say first 100 lines) SOAP UI response in excel sheet using groovy scrip
I want to save only first 100 lines from response which is in JSON format.
Because when my response is too big then excel can not hold the entire response in one cell.
so it gets crashed, and i am not able to save a single response in excel.
I am using SOAP UI free version. so need groovy script to limit the response, so that excel didnt get crashed.
One option is truncate the response to the maximum number of characters that can saved in Excel, or less.
context.response.take(32000)
https://stackoverflow.com/questions/3226487/how-to-truncate-a-string-in-groovy
Like pretty print?
import groovy.json.* log.info JsonOutput.prettyPrint(context.response)
The script I gave you updates all Test Cases in the same Test Suite (as the script).
You can go one step further out if you want to update all Test Cases in all Test Suites in the current Project:
testRunner.testCase.project.testSuites.each { testSuite -> testSuite.value.testCases.each { testCase -> testCase.value.testSteps.each { def testStep = it.value if (testStep instanceof com.eviware.soapui.impl.wsdl.teststeps.RestTestRequestStep) { testStep.testRequest.setDiscardResponse(true) } } } }