How to invoke a test step with inputs at runtime from groovy script in SOAP UI? -


i writing validation groovy script test step, intended test soap web service.

now, want call same test step, different input value groovy script. possible? dont want write test step.

thanks

yes it's possible, anyway question open purpose follow approach.

use example testcase properties in teststep request, way can change properties reuse same request more once. so, use follow syntax in teststep: ${#testcase#yourproperty}, supposing example you've soap request, can be:

<soapenv:envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">    <soapenv:body>         <somerequest>             <changevalue>${#testcase#yourproperty}</changevalue>         <somerequest>    </soapenv:body> </soapenv:envelope> 

then in groovy teststep can set property value , call teststep times want, see follow code hope it's self explanatory:

// testcase def tc = testrunner.testcase  // set value property tc.setpropertyvalue('yourproperty','somevalue')  // teststep name def ts = tc.getteststepbyname('teststepname')  // invoke teststep  ts.run(testrunner,context) 

if example run teststep various times based on property value, can use:

// testcase def tc = testrunner.testcase // teststep name def ts = tc.getteststepbyname('teststepname') // property values def propertyvaluearray = ['firstvalue','anothervalue','morevalues','lastone']  // each property value propertyvaluearray.each { value ->     // set value property     tc.setpropertyvalue('yourproperty',value)     // invoke teststep      ts.run(testrunner,context) } 

hope helps,


Comments