Forum Discussion
- depecheContributorHi!
you can use this:
testRunner.testCase.testSuite.project.setPropertyValue("PropertyName","PropertyValue");
Hope this might help you.
Regards,
depeche - SmartBear_SuppoSmartBear 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:
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- DeeJunFanNew 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
- DeeJunFanNew 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
- SmartBear_SuppoSmartBear Alumni (Retired)Hello,
To set a global property, use:
com.eviware.soapui.model.propertyexpansion.PropertyExpansionUtils.globalProperties['user'].value = ...
replace 'user' with the name of your global property.
Regards,
Dain
eviware.com - arunpanjalaOccasional ContributorHi,
I'm trying to set global properties and following is the error encountered :
"java.lang.NullPointerException: Cannot set property 'value' on null object"
This is the code I'm using to set the global value in start script of my Mock Service : com.eviware.soapui.model.propertyexpansion.PropertyExpansionUtils.globalProperties['TestsysUID'].value = "Test";
Am I missing anything else here? Please suggest.
Thanks,
Arun - depecheContributorHi Dain,
Thats correct dain. What i posted is for project level properties.
Is there any other way around apart from what i posted to set the project level or test suite level or test case level properties? I mean to say by using com.eviware.soapui.model.propertyexpansion or any other in groovy script.
Regards,
depeche
Related Content
- 10 months ago
Recent Discussions
- 15 years ago