码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2015-06-26 13:25:23      阅读:166      评论:0      收藏:0      [点我收藏+]

标签:

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)
}

  

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

标签:

原文地址:http://www.cnblogs.com/MasterMonkInTemple/p/4602005.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!