Forum Discussion

eugwork's avatar
13 years ago

passing values from groovy script to soap request

I’m trying to figure out if there is any way I could pass a value from a groovy script to a soap request. I tried using ‘setpropertyvalue’, to pass it to a property; then do a property transfer to the SOAP request, but for some reason the properties in the test case steps don’t get updated!!
=============
// This is the ‘setpropertyvalue ‘ statement, where I may be going wrong.
def myTestCase = context.testCase
myTestCase.setPropertyValue(‘${Input numbers#num1}’, lines_first)
// ‘Input numbers’ is the name of one of my test case properties.
// ‘num1′ is one of the properties in the property list ‘Input numbers’
// lines_first – This is a value I pull from a txt file, basically it would just be a number.
=============
Any help would be greatly appreciated

1 Reply

  • M_McDonald's avatar
    M_McDonald
    Super Contributor
    From your description it sounds like you are trying to update a Property 'num1' within a Properties step called 'Input Numbers', but the method you are using would only update the test cases own properties, not those within a Property step. Try using the GroovyUtils setProperty method:

    def gu = new com.eviware.soapui.support.GroovyUtils( context )
    gu.setPropertyValue('Input Numbers', 'num1', lines_first[i])