Forum Discussion

simonjdonnelly's avatar
simonjdonnelly
Contributor
9 years ago
Solved

Setting Request Properties - stripWhitespaces and removeEmptyContent using Groovy

Hi,

 

As part of a clean up exercise with Soap UI/Ready API, I would like to be able to set the value of two Soap Test Request properties:

 

1. Strip whitespaces

2. Remove empty content

 

I have been able to access the current values of these properties using the follow groovy snippet:

 

testStep.getTestRequest().getProperties().getAt("stripWhitespaces")
testStep.getTestRequest().getProperties().getAt("removeEmptyContent"

Althought, having spent quite a long time looking, I have struggled to find a way to set these values to 'true'.

 

I know how to get and set Custom Properties, but I am struggling on some of the Request Properties.

 

Any help would be appreciated.

 

Simon.

 

 

  • Figured it out - very simple in the end :manembarrassed:

     

    for( testSuite in testRunner.testCase.testSuite.project.getTestSuiteList() ) {
    	for( testCase in testSuite.getTestCaseList() ) {    
    		for( testStep in testCase.getTestStepList() ) {
    			if( testStep instanceof com.eviware.soapui.impl.wsdl.teststeps.WsdlTestRequestStep ) {
    
    				testStep.getTestRequest().setStripWhitespaces(true)
    				testStep.getTestRequest().setRemoveEmptyContent(true)
              
                     }
    		}
    	}
    }

2 Replies

  • Figured it out - very simple in the end :manembarrassed:

     

    for( testSuite in testRunner.testCase.testSuite.project.getTestSuiteList() ) {
    	for( testCase in testSuite.getTestCaseList() ) {    
    		for( testStep in testCase.getTestStepList() ) {
    			if( testStep instanceof com.eviware.soapui.impl.wsdl.teststeps.WsdlTestRequestStep ) {
    
    				testStep.getTestRequest().setStripWhitespaces(true)
    				testStep.getTestRequest().setRemoveEmptyContent(true)
              
                     }
    		}
    	}
    }
    • TanyaYatskovska's avatar
      TanyaYatskovska
      SmartBear Alumni (Retired)

      Hi Simonjdonnelly,

       

      Thanks for sharing your solution with us :)