7

I have created some list of properties under the TestCase. For example look at the following screenshot.

SoapUI Pro - Testcase Properties

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

roblogic
  • 1,266
  • 2
  • 13
  • 23
Karunagara Pandi
  • 634
  • 7
  • 16
  • 27

4 Answers4

6

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.

Billal Begueradj
  • 20,717
  • 43
  • 112
  • 130
Karunagara Pandi
  • 634
  • 7
  • 16
  • 27
6

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.

Rami Sharaiyri
  • 526
  • 5
  • 16
0

Manual solution: use "Save Properties" and "Load Properties" from SoapUI

SoapUI Save Properties button

  1. export the properties to a text file, e.g. customprop.txt
  2. edit the file and delete the unwanted properties
  3. import the file back into your soapUI project
  4. 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

Community
  • 1
  • 1
roblogic
  • 1,266
  • 2
  • 13
  • 23
0

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:

  1. Set the values of the Properties you want to delete to deleteMe
  2. Search for the string deleteMe in your soapui-project.xml
  3. Delete the properties:

<con:property><con:name>name</con:name><con:value>deleteMe</con:value></con:property>

RoBeaToZ
  • 1,113
  • 10
  • 18