How to set variable of a TestObject SOAP request with script

Hello,

I have a request called “Request1” into my Object Repository. I defined one variable called “variable1” into this object.

How can I set the variable from script view? I already tried to get the object with findTestObject but there is no function to set variables …

Someone can help me please? Thanks a lot.

Update 1

I found this solution but I don’t know if it is a best pratice …

def request = findTestObject('RequestObject', [('variable') : 'some text'])
def response = WS.sendRequest(request)

when using predefined request objects (in object repository) this is the right way to bind values to variables

1 Like

edited a bit my previous reply, to avoid confussions, i was refereing only to that particular solution.

there are also other options, like building the requests programaticaly. there, things goes a bit different.
between the two, i opt for the solution you choose. i’m a lazy coder :slight_smile: