Forum Discussion
Elsevier_-_OH_S
11 years agoContributor
Well point and click approach failed i was doing it previously after refactoring my WSDL file....its kind of hardcoaded... when u refactor ur WSDL it wont change the version of WSDL comes with that xPath into that request field....and my 200 test cases failed ... we have several versions of WSDL for these test cases...i cant do this thing everytime....so i want to set it at project level ....we were able to do for this problem getting a header value and putting it at project level and using it into the request where ever we want. Below code worked for us while taking value from response header it worked fine.
def TokenMatch = String.valueOf(testRunner.testCase.getTestStepByName("Send Request").httpRequest.response.responseHeaders["Token"]) =~ /\[(.*)\]/
def AuthToken = TokenMatch[0][1]
testRunner.testCase.testSuite.project.setPropertyValue("AuthToken", AuthToken)
No we wnat same thing to do getting value from our response body but i dnt know what property to use for response body as we used responseHeaders. If jut want to know any property to use for getting value from response body, it will solve my purpose.
def TokenMatch = String.valueOf(testRunner.testCase.getTestStepByName("Send Request").httpRequest.response.responseHeaders["Token"]) =~ /\[(.*)\]/
def AuthToken = TokenMatch[0][1]
testRunner.testCase.testSuite.project.setPropertyValue("AuthToken", AuthToken)
No we wnat same thing to do getting value from our response body but i dnt know what property to use for response body as we used responseHeaders. If jut want to know any property to use for getting value from response body, it will solve my purpose.