How to write property value in setup script for test suiteS?
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How to write property value in setup script for test suiteS?
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
Solved! Go to Solution.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I am trying to set property in project setup and tear down . But it is giving error as "groovy.lang.MIssingPropertyException: No such property: for testRunner class: Script 12"
I used:
testRunner.testCase.testSuite.project.setPropertyValue( "Prop", Value)
Please help on this how to resolve this issue or suggest me how t set project property under tear down step.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I am trying to set property in project setup and tear down . But it is giving error as "groovy.lang.MIssingPropertyException: No such property: for testRunner class: Script 12"
I used:
testRunner.testCase.testSuite.project.setPropertyValue( "Prop", Value)
Please help on this how to resolve this issue or suggest me how t set project property under tear down step.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It suggests "Prop" does not exist at the project level. Can you try writing out the existing properties using getPropertyNames() in some sort of loop? And in the loop use log.info to write out the names?
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I found this thread when I was trying to accomplish the same thing.
In a project's Setup Script and TearDown Script, we have direct access to the 'project' object.
So, setting a custom project property is simply:
project.setPropertyValue( "PropName", Value )
Getting all project custom properties:
def allProps = project.getProperties()
And removing a specific project custom property:
project.removeProperty( "PropName" )
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I tried to set property at test suite level from Test Suite's SetUp script using the code you shared above. But that doesn't work.
It throws the following error
ERROR: com.eviware.soapui.support.scripting.ScriptException: Error in Setup Script of TestSuite
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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 )
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank You !
That works 🙂
