cancel
Showing results for 
Search instead for 
Did you mean: 

Having trouble with property transfer

New Contributor

Having trouble with property transfer

All,

I'm on SoapUI 5.0.0.

I'm having trouble with property transfers. I've read the docs but still don't get it.

All I want to do is set a session id to be reused in multiple test steps. I know I want to generate the id with ${=UUID.randomUUID().toString()}. Assigning that to a test case property causes that literal value (${=UUID.randomUUID().toString()}) to be inserted anywhere I reference it, such as in each test step with ${#session_id}. When that happens, I get a unique guid each time when I really want the same guid over and over.

I know this should be super easy but I'm not getting it.

thanks
2 REPLIES 2
New Contributor

Re: Having trouble with property transfer

Call ${=UUID.randomUUID().toString()} once
Then save the response in another property
And then Reuse the newly created property in your further test steps
Community Hero

Re: Having trouble with property transfer

Another way to set it a property, so that you would be able to access it from the rest of the steps is:
Have a groovy script with the following line

testRunner.testCase.setPropertyValue('GENERATED_ID', UUID.randomUUID().toString())


In the test request step where you required the property use as below

<some_request_element>${#TestCase#GENERATED_ID}</some_request_element>


In order to use above variable in another groovy step of the same test case is:

testRuner.testCase.getProperty('GENERATRED_ID')
//OR
context.expand('${#TestCase#GENERATED_ID}')


Regards,
Rao.
New Here?
Join us and watch the welcome video:
Announcements