Forum Discussion
biju74
12 years agoNew Contributor
Add a groovy step with following code
import com.eviware.soapui.impl.wsdl.teststeps.*
import com.eviware.soapui.support.types.StringToStringMap
def testSuite = testRunner.testCase.testSuite
def accessToken = "MyToken"
def headers = new StringToStringMap()
headers.put("Authorization","Bearer " + accessToken)
testSuite.testCaseList.each { testCase ->
log.info("Setting ${testCase.name}")
testCase.testStepList.each { testStep ->
log.info("Setting ${testStep.name}")
if(testStep instanceof RestTestRequestStep ) {
log.info("Setting HTTP headers ${headers} in test case ${testStep.name}")
testStep.testRequest.setRequestHeaders( headers)
}
}
}
import com.eviware.soapui.impl.wsdl.teststeps.*
import com.eviware.soapui.support.types.StringToStringMap
def testSuite = testRunner.testCase.testSuite
def accessToken = "MyToken"
def headers = new StringToStringMap()
headers.put("Authorization","Bearer " + accessToken)
testSuite.testCaseList.each { testCase ->
log.info("Setting ${testCase.name}")
testCase.testStepList.each { testStep ->
log.info("Setting ${testStep.name}")
if(testStep instanceof RestTestRequestStep ) {
log.info("Setting HTTP headers ${headers} in test case ${testStep.name}")
testStep.testRequest.setRequestHeaders( headers)
}
}
}