Forum Discussion

mpw83's avatar
mpw83
Contributor
6 years ago

Remove all the properties starts with given value

I found that I can use the following groovy script line to remove the given property  testRunner.testCase.removeProperty('ScheduleID'); In my test case, I have properties like 'ScheduleID0' , 'Sc...
  • HimanshuTayal's avatar
    6 years ago

    Hi mpw83 ,

     

    You can use more of groovy to find solution of your problem, first count the number of properties stored under Test Case custom properties and then delete the selected properties, refer below code for reference:

     

    def targetTestCase = testRunner.testCase;
    def propList = targetTestCase.getPropertyNames()
    propList.each{
    	if(it.contains("ScheduleID")){
    		targetTestCase.removeProperty(it);
    	}
    	else{
    		//Do nothing
    	}
    }