木吟

导航

更改TestStep的request header和获取TestStep的response header

更改TestStep的request header

for example

def userId = "xxxxxxxxxxxxx"
def request = context.testCase.getTestStepByName("xxx").testRequest
def existingHeaders = request.requestHeaders
existingHeaders["X-API-UserId"] = [(userId)]
request.requestHeaders = existingHeaders

 

获取TestStep的response header

1. get the response header of  the current test step

def requestId = context.currentStep.testRequest.response.responseHeaders["RequestId"]

2. get the response header of which is not the current test step

def requestId = context.testCase.getTestStepByName("xxxx").testRequest.response.responseHeaders["RequestId"]

 

posted on 2017-05-22 15:33  木吟  阅读(246)  评论(0编辑  收藏  举报