Remove project custom properties with TestRunner
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Remove project custom properties with TestRunner
Hello everybody,
I'm looking for a solution to remove custom properties from my project.
Indeed, during an execution with the TestRunner, I save data in project custom properties and I would like delete them with a script.
This bellow script work fine when I play it with the Test Case execution, but not with the Test Runner Execution :
runner.project.properties.each {
if (testRunner.project.properties[it.key].name == 'XRAY-ID'){
log.info('On ne fait rien')
}
else {
if (testRunner.project.properties[it.key].name.contains('P_') == true){
testRunner.project.removeProperty(testRunner.project.properties[it.key].name)
}
}
}
This script is positionned in a Script Test Step.
Do you have an idea ?
Thank you in advance for your help,
Anthony
Solved! Go to Solution.
- Labels:
-
Automation Environments
-
Scripting
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I figured out your answer by looking at my own question and finding the soap ui docs. The problem is that the docs are very hard to find, but I found them anyway.
Try this - testRunner.testCase.removeProperty('property1')
Rest of the details:
My question - https://community.smartbear.com/t5/API-Functional-Security-Testing/Access-custom-properties-programm...
This is how I figured it out:
log.info(testRunner.testCase.getClass())
This gives class com.eviware.soapui.impl.wsdl.WsdlTestCasePro.
Google the above class. Its at https://support.smartbear.com/readyapi/apidocs/3.0.0/pro/com/eviware/soapui/impl/wsdl/WsdlTestCasePr... . Search for removeProperty method or something like that.
This class might have remove method - https://www.soapui.org/apidocs/5.5.0/index.html?com/eviware/soapui/impl/wsdl/AbstractTestPropertyHol...
Lets try testRunner.testCase.removeProperty('prop1'). It works.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If the project is run from commandline, and the property is created dynamically, then you don't have to remove it manually unless if you are using option "-s".
Regards,
Rao.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello rajs2020,
Thank you for your answers and your links, I'll watch them!
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello nmrao,
Effectively, I run the project in command line (from a Gitlab pipeline) and I was thinking the properties was save. Thank you for this information !
