Forum Discussion
FelixNawroth
14 years agoNew Contributor
I ran into the same problem. The solution is simple: There is both StringToStringMap and StringToStringsMap in com.eviware.soapui.support.types - the method expects the plural variant.
Here's an adaption of M McDonald's script (combined with code from https://thewonggei.wordpress.com/2010/08/05/configure-http-basic-auth-once-for-soapui-test-suties/) to write TestSuite properties into the headers of all called TestRequests:
Just set the properties ExampleHeaderName and ExampleHeaderValue for your TestSuite and use the script as "Setup Script" of the TestSuite.
Here's an adaption of M McDonald's script (combined with code from https://thewonggei.wordpress.com/2010/08/05/configure-http-basic-auth-once-for-soapui-test-suties/) to write TestSuite properties into the headers of all called TestRequests:
import com.eviware.soapui.impl.wsdl.teststeps.*
import com.eviware.soapui.support.types.StringToStringsMap
for( testCase in testSuite.getTestCaseList() ) {
for( testStep in testCase.getTestStepList() ) {
if( testStep instanceof WsdlTestRequestStep ) {
def headers = new StringToStringsMap()
headers.put(testSuite.getPropertyValue("ExampleHeaderName"),testSuite.getPropertyValue("ExampleHeaderValue"))
log.info("Setting HTTP headers ${headers} in test case ${testCase.getLabel()}")
testStep.getTestRequest().setRequestHeaders(headers)
}
}
}
Just set the properties ExampleHeaderName and ExampleHeaderValue for your TestSuite and use the script as "Setup Script" of the TestSuite.
Related Content
- 9 years ago
Recent Discussions
- 2 days ago