Forum Discussion
- richieCommunity Hero
Hi,
If I understand correctly - this seems fairly straight forward - if I'm getting the gist
the cookie's in the response headers - right? There's a bit of groovyscript one of the other lads on the forum gave me to do this.
Essentially you need to perform a property transfer, grabbing the cookie's value writing it either directly to the subsequent request or a Properties step. I did the same thing on a test case and it had the following steps
1st REST request step (generates the cookie)
Groovy step
Properties step
2nd REST request step
The code to grab the cookie's value from the 1st REST step headers and save it to the Properties step is as follows:
//Takes one of the elements of the response Header def value = testRunner.testCase.testSteps["1st REST request step)"].testRequest.response.responseHeaders["cookieName"] //Read this value into a parameter def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context ) groovyUtils.setPropertyValue("Properties", "cookieName",value[0])
If I understand what you need - this will do it - if I don't then I've wasted your time reading this and mine typing this out! :)
Cheers!
richie
- LucianCommunity Hero
Just right click on the test case -> settings -> maintain http session. This should do it...
Related Content
- 10 years ago
- 6 years ago
Recent Discussions
- 5 days ago