How to remove Custom Properties from a SoapUI TestCase using Groovy?

后端 未结 4 710
长情又很酷
长情又很酷 2021-01-13 00:29

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

\"SoapU

相关标签:
4条回答
  • 2021-01-13 00:44

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

    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

    0 讨论(0)
  • 2021-01-13 00:47

    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.

    0 讨论(0)
  • 2021-01-13 00:51

    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.

    0 讨论(0)
  • 2021-01-13 00:57

    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>

    0 讨论(0)
提交回复
热议问题