I have created some list of properties under the TestCase. For example look at the following screenshot.
I tried to remove Testcase_Property property through the following groovy script teststep:
testRunner.testCase.testSuite.removeProperty( "Testcase_Property" );
when I reload the project, the Testcase_Property property is still exist in the Custom Properties tab when I click on the Test case name.
Anyone suggest me what the correct script to remove the custom properties in SoapUI.
Thanks
Karunagara Pandi
you can also use the following:
data = context.testCase.getTestStepByName("Test Case Name");
String[] propToRemove = new String[data.getPropertyCount()];
propToRemove = data.getPropertyNames();
for ( int i = 0 ; i < propToRemove.size(); i++ ){
data.removeProperty( propToRemove[i] );
}
Hope this helps.
Now you can remove more than one prop.
Finally I got the answers for removing Project, Testsuite and Testcase custom properties. Here are the scripts.
testRunner.testCase.testSuite.project.removeProperty( "Project_Level_Property" );
testRunner.testCase.testSuite.removeProperty( "Testsuite_Property" );
testRunner.testCase.removeProperty( "Testcase_Property" );
If any other way is there, please let me know friends.
Manual solution: use "Save Properties" and "Load Properties" from SoapUI
- export the properties to a text file, e.g.
customprop.txt
- edit the file and delete the unwanted properties
- import the file back into your soapUI project
- in the "load properties" dialog check the option to "delete remaining"
Then the existing properties will be cleared out and replaced with your customprop.txt
Just for completeness:
Another quick but dirty and dangerous way is to modify the soapui-project.xml
and remove the property nodes with a text editor.
Be aware that you can break your whole project if you do something wrong!
You should create a copy of your soapui-project.xml
and do the following steps:
- Set the values of the Properties you want to delete to
deleteMe
- Search for the string
deleteMe
in your soapui-project.xml
- Delete the properties:
<con:property><con:name>name</con:name><con:value>deleteMe</con:value></con:property>