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
In the groovy script, add the following script. This script will assign a string text to the property and then it will show in the log after executing the test case. Once written the above script in the editor, double-click on the test case name step. and the see the results in the script log tab.
Both global and system properties can be set directly from the command-line when running any of the SoapUI bat/sh files; -Dproperty.name=value sets a system property and -Gproperty.name=value sets a Global Property.
Test suite properties appear when click on the respective test suite name under the project. To add custom properties as needed, click on custom properties tab and click on the '+' sign under it. Test case properties are accessible within the test case.
Call One Groovy Class from Another Groovy Class To create a class in SoapUI, right-click on TestStep and choose Groovy Script to open the editor. Save the class as MyClass and then write the following code, as shown below. Click on the run button to execute the Groovy script.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With