您的位置:首页 > 产品设计 > UI/UE

[SoapUI] 循环遍历某个Test Case下的所有Test Step,将Cookie传递给这些Test Step

2015-06-26 12:31 591 查看
import com.eviware.soapui.support.types.StringToStringMap

//Get cookie's value from the project level properties
String cookie = context.expand( '${#Project#cookie}' )
log.info "cookie : "+cookie

//Put cookie to StringMap
def cookieMap = new StringToStringMap()
cookieMap.put("Cookie",cookie)

//Just add other test steps here if they also need cookie
def testStepList = testRunner.testCase.getTestStepsOfType(com.eviware.soapui.impl.wsdl.teststeps.RestTestRequestStep.class)
log.info "Test step number : "+testStepList.size()
for (testStep in testStepList){
log.info "Pass cookie to  test step : "+testStep.name
testStep.testRequest.setRequestHeaders(cookieMap)
}


  
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: