I want to write a groovy script that sets input in requests. It works fine when the groovy is executed within the same testsuite, but I want this script the go thru several testsuites. This is my code, for testing I am getting the 5th testsuite, the first testcase and the first teststep. It is the getXmlHolder line the fails with "Unexpected CDATA" error. I have tried to add the testSuite and testCase to the inputHolder string but that doesn't help either.
def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
def project = context.testCase.testSuite.project
def testSuite = project.getTestSuiteAt(5)
log.info(testSuite.getLabel())
def testCase = testSuite.getTestCaseAt(0)
log.info(testCase.getLabel())
def testStep = testCase.getTestStepAt(0)
log.info(testStep.getLabel())
def teststepname = testCase.getTestStepAt(0).getName().toString()
def inputHolder = +teststepname + "#Request"
log.info(inputHolder);
def holderRawReq = groovyUtils.getXmlHolder(inputHolder)
holderRawReq["//tem:brandId"] = "test"
I think the getXmlHolder only checks in the testSuite it resides in, so the question is how to make it access other testSuites?