Forum Discussion

srinivas_das_l's avatar
srinivas_das_l
Contributor
15 years ago

Updating testStep from testSuite - Teardown script ??

Hi All,

I can't able to update request values of a testStep from TestSuite -teardown script .When i execute following code
in logs ,It's showing element is updated but actually it remains the same .
Can anyone tell me the way ,how to do it ??

Code :
def groovyUtils    =    new com.eviware.soapui.support.GroovyUtils( context )
def request1 = testSuite.getTestCaseByName("Test Case").testSteps["teststep"].testRequest
def requestContent = request1.requestContent
def holder =  groovyUtils.getXmlHolder(requestContent)   
def h = holder.getNodeValue("//man:customerId")     
  def y= holder.getNodeValue("//man:customerId")     
holder.setNodeValue("//man:customerId","234")
        holder.updateProperty()   

but it's not updating

2 Replies

  • Can anyone give me idea  about the below mentioned query ??It's almost 4 days ,I haven't got any replies . plz give ur comments ..
  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hello,

    You need to create the XmlHolder with a reference to the actual property, otherwise updateProperty won't do anything. Instead of callong holder.updateProperty(), set the request to the XML content as follows:


    def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
    def request1 = testSuite.testCases["Test Case"].testSteps["teststep"].testRequest
    def holder =  groovyUtils.getXmlHolder(request1.requestContent)   

    def h = holder.getNodeValue("//man:customerId")   
    def y = holder.getNodeValue("//man:customerId")   
    holder.setNodeValue("//man:customerId","234")

    request1.requestContent = holder.xml


    Regards,
    Dain
    eviware.com