Created
July 19, 2017 14:38
-
-
Save einaralex/afaad58bc370d1e34cc441c142a289e5 to your computer and use it in GitHub Desktop.
Set headers script for SoapUI
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.eviware.soapui.support.types.StringToStringMap | |
import com.eviware.soapui.impl.wsdl.teststeps.* | |
// loop through every teststep in that testcase | |
for(testStep in testRunner.testCase.getTestStepList()){ | |
if(testStep instanceof WsdlTestRequestStep) { | |
def headers = new StringToStringMap() | |
headers.put("X-End-User","User") | |
headers.put("X-Audit-Guid","\${=java.util.UUID.randomUUID().toString().replace(\"-\",\"\").toUpperCase()}") | |
headers.put("X-System-Id","ID") | |
// Debugging messages | |
log.info("Setting HTTP headers ${headers} in test case ${testStep.getName()}") | |
// Set the headers | |
testStep.getTestRequest().setRequestHeaders(headers) | |
// Additionally add "Not SOAP Fault assertion | |
def assert_1 = testStep.addAssertion("Not SOAP Fault") | |
assert_1.setName("Not SOAP Fault") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment