Forum Discussion

vikititor's avatar
vikititor
Contributor
5 years ago

Clean TC and TS propertis when saving project

I am using the ReadyAPI and GIT. I wnat to have all the properties visible to me during developing the tests = I dont want to enable the new settins in preferences (to clean properties after test cas...
  • vikititor's avatar
    5 years ago

    in the project save script remove line with "def project".. 

    and enable save/load scripts in ReadyAPI preferences

  • vikititor's avatar
    vikititor
    4 years ago

    Here is updated script, you can even filter the propertie name, when for example insluce # prefix in the name.. so skip the clening.. 

     

    Here is full script for project = will not work under groovy script test step.. 

    log.info "*********** SAVE PROJECT script ***********";
    log.info "Cleaning the properties values - start"
    for ( t in project.getTestSuiteList() ) {
    	log.info " -s " + t.name 
    	//log.info "-suite propertis count: " + t.getPropertyCount()
    	
    	for ( c in t.getTestCaseList() ) {
    		log.info " --tc " + c.name
    		//log.info " -- suite propertis count: " + c.getPropertyCount()
    		
    		if (c.getPropertyCount() > 0) {
    			
    			for( n in c.propertyNames ){
    				log.info " --- tcp " + n + " value: " + c.getPropertyValue(n)
    				if (n.substring(0,1) != "#"){
    					if (n == "countDown") {
    						c.setPropertyValue( n, '0')		
    						}  					
    					else {
    						c.setPropertyValue( n, '')
    						}
    					}
    				else
    					{log.info " ---- cleaning skipped"}				
    				}
    			}	   	
    		}
    	}
    
    log.info "Cleaning the properties values - finished"