Created
January 22, 2017 03:04
-
-
Save imadi/3540184759c99175c7c36d532bff7b0a to your computer and use it in GitHub Desktop.
Revisions
-
imadi created this gist
Jan 22, 2017 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ def testStep= testRunner.runTestStepByName("User") def response = testStep.response def cookies = response.responseHeaders["Set-Cookie"].toString() String cookie = cookies.split(";")[0] def regex = /(JSESSIONID=[A-Za-z0-9.]+)/ matcher = ( cookies =~ regex ) def jsessionId if(matcher.find()){ jsessionId = matcher[0][0] } log.info("sessionId : " + jsessionId) //get UserAddress testStep = testRunner.testCase.testSuite.getTestCaseByName("Login").getTestStepByName("UserAddress") def testRequest = testStep.getTestRequest() def headers = testRequest.requestHeaders headers.put('Cookie',jsessionId + '; Path=/; Secure') testRequest.requestHeaders = headers testStep = testRunner.runTestStepByName("UserAddress") log.info("response : " +testStep.response.getContentAsString())