Ask a Question

Remove project custom properties with TestRunner

SOLVED
APERRY
Occasional Contributor

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

1 ACCEPTED SOLUTION

Accepted Solutions
nmrao
Community Hero

Re: Remove project custom properties with TestRunner

What is your use case.?
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.

View solution in original post

4 REPLIES 4
rajs2020
Frequent Contributor

Re: Remove project custom properties with TestRunner

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.

 

nmrao
Community Hero

Re: Remove project custom properties with TestRunner

What is your use case.?
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.

View solution in original post

APERRY
Occasional Contributor

Re: Remove project custom properties with TestRunner

Hello rajs2020,

 

Thank you for your answers and your links, I'll watch them!

APERRY
Occasional Contributor

Re: Remove project custom properties with TestRunner

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 !

cancel
Showing results for 
Search instead for 
Did you mean: