Hi,
I tried all the scripts provided but I found a couple of problems with a couple of them - I managed to fix all but the last one - but the I'm a bit stuck on the code that writes out the cookies to the Properties step
the script for saving the 'Set-Cookie' values to the Properties step is as below:
import groovy.json.*
def headers = testRunner.testCase.testSteps["REST Request"].testRequest.response.responseHeaders
headers.each {
if (it.getKey() == 'Set-Cookie') { // assuming this is a map
def valueParts = it.getValue().split('=') // Split the value on the equals
testRunner.testCase.setPropertyValue(valueParts[0], it.getValue())
}
}
// This would get you the following test case properties:
testCase.getPropertyValue('returnurl') // returnurl=9d97d277ed656a2...
testCase.getPropertyValue('authtype') // authtype=72b76f4f5cf...
testCase.getPropertyValue('state') // state=81ef1f0ff48fcd...
testCase.getPropertyValue('nonce') // nonce=7511a89aaacda...
HOWEVER - this returned the following error
groovy.lang.MissingMethodException: No signature of method: java.util.ArrayList.split() is applicable for argument types: (java.lang.String) values: [=] Possible solutions: split(groovy.lang.Closure), split(groovy.lang.Closure), split(groovy.lang.Closure), wait(), init(), init() error at line: 5
so I think there's either a missing closing bracket (even though it looks fine to me - or perhaps its the wrong type (string to list???)
I'm sorry - I just have no idea how to handle this - can anyone advise?
I did get the other scripts working including nmrao's to grab the cookies and pass directly onto another step - but I've been told I might need to save the cookies off for other use - so I really need to park the cookies into a Properties step if possible?
Grateful for all and any help as always! :)
Cheers,
richie
as