Forum Discussion

sprocketx33's avatar
sprocketx33
Occasional Contributor
16 years ago

Problems trying to set values in groovy script

I'm trying to set property values using a grouvy script without success. I don't get an error just the values don't get changed. Below is the script I'm using. Being new to Soapui etc I'm not sure if I'm missing something or if this is a known issue.

##############################################
def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
log.info( groovyUtils.projectPath )

def holder = groovyUtils.getXmlHolder( "listDocuments#Response" )

def holder2 = groovyUtils.getXmlHolder( "addFromDocumentsCaseData#Request" )

for (handle in holder.getNodeValues( "//ns1:listDocumentsResponse/documents/handle" ))
holder2.setNodeValue( "//ws:addFromDocuments/srcDocumentHandleList", handle ))



Thanks
Keith

14 Replies

  • M_McDonald's avatar
    M_McDonald
    Super Contributor
    What about using property expansion, ie. put ${Properties#username} in the Username field, etc. and then change the associated property rather than the Auth tab directly?
  • sprocketx33's avatar
    sprocketx33
    Occasional Contributor
    So put "${Properties#username}" in the username field on the auth tab?

    That said I would guess I could also instead of using the properties file use say a Datasource step to populate this field?

    something like "${DataSourcex#username}"

    Thanks
    Keith
  • sprocketx33's avatar
    sprocketx33
    Occasional Contributor
    Awsome. worked like a charm only issue is setting the password field you need to set it by first creating the property expansion string in something like notepad and then pasting into the password field as it is a masked field so you can't see whats in there once you paste it.

    Thanks
    Again!