CXin
11 years agoFrequent Contributor
How to write property value in setup script for test suiteS?
I need to set value to custom properties in setup scripts for all test suites.
Does any one know how to do that?
I tried all below scripts, neither of them work for me.
The error message always say couldn't find the property.
My understanding is the custom properties for all test suites are not project property or global project, it seems they are not testSuite property either...
Please kindly help
Does any one know how to do that?
I tried all below scripts, neither of them work for me.
def testCaseProperty = testRunner.testCase.getPropertyValue( "MyProp" )
def testSuiteProperty = testRunner.testCase.testSuite.getPropertyValue( "MyProp" )
def projectProperty = testRunner.testCase.testSuite.project.getPropertyValue( "MyProp" )
def globalProperty = com.eviware.soapui.SoapUI.globalProperties.getPropertyValue( "MyProp" )
The error message always say couldn't find the property.
My understanding is the custom properties for all test suites are not project property or global project, it seems they are not testSuite property either...
Please kindly help
- Hi,
How are you setting the property? The code you posted is getting the properties that should have already been set. If you would like to set the properties using groovy then the following methods will work.
testRunner.testCase.setPropertyValue( "MyProp", someValue )
testRunner.testCase.testSuite.setPropertyValue( "MyProp", someValue )
testRunner.testCase.testSuite.project.setPropertyValue( "MyProp", someValue )
com.eviware.soapui.SoapUI.globalProperties.setPropertyValue( "MyProp", someValue )
That comes from our Tips n' Tricks page here, http://www.soapui.org/Scripting-Propert ... properties.
Regards,
Marcus
SmartBear Support Since you are in the Test Suite Setup Script, the "project" object is not available (and you need to define the 'Value' property, if you haven't). Try:
String Value = "Some Value" testSuite.setPropertyValue( "PropName", Value )