Forum Discussion
SmartBear_Suppo
SmartBear Alumni (Retired)
Hello,
The code I posted only works if the property already exists. What depeche posted is correct, but the code works project level properties, not for the global properties. However the change to write global properties is simple:
This will set a global property, and first create it if it doesn't already exist.
Regards,
Dain
eviware.com
The code I posted only works if the property already exists. What depeche posted is correct, but the code works project level properties, not for the global properties. However the change to write global properties is simple:
com.eviware.soapui.model.propertyexpansion.PropertyExpansionUtils.globalProperties.setPropertyValue('PropertyName', 'PropertyValue')
This will set a global property, and first create it if it doesn't already exist.
Regards,
Dain
eviware.com
DeeJunFan
9 years agoNew Contributor
Hi,
I'm pretty new to SoapUI and for me this code isn't creating a global property if it doesnt already exist.
com.eviware.soapui.model.propertyexpansion.PropertyExpansionUtils.globalProperties.setPropertyValue('{PropertyName}', '{value})
Anyone know how i can create Global Properties from a script in a mock service if they dont already exist?
Thanks
D
- DeeJunFan9 years agoNew Contributor
My Apologies,
The code does work.
I had placed the code in the wrong script (had it in the set response) But the get was being called at an earlier stage which attempted to use the Global property.
So, thanks for the info. Worked a treat!
D
Related Content
- 10 months ago
Recent Discussions
- 15 years ago