cancel
Showing results for 
Search instead for 
Did you mean: 

Transfer parameters between Groovy scripts in SoapUI

SOLVED
Occasional Contributor

Transfer parameters between Groovy scripts in SoapUI

I have a `Groovy` script, it is present as a test step. I need to pass a parameter value from it to another `Groovy` script, which is in a script assertion, in a `SOAP` request. These are executed after each other. `Property Transfer` step is unable to do this.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Hero

Re: Transfer parameters between Groovy scripts in SoapUI

Hi,

You can use the context object to pass the value.

// in groovy script
context.myvar = "somevalue"
// in script assertion
assert context.myvar == "somevalue"

See also the example SoapUI project file attached.

2 REPLIES 2
Highlighted
Community Hero

Re: Transfer parameters between Groovy scripts in SoapUI

Hi,

You can use the context object to pass the value.

// in groovy script
context.myvar = "somevalue"
// in script assertion
assert context.myvar == "somevalue"

See also the example SoapUI project file attached.

Super Contributor

Re: Transfer parameters between Groovy scripts in SoapUI

I loaded your script and ran it in Ready 2.6 but it fails.

 

 

New Here?
Join us and watch the welcome video:
Join the Online Event to Win