Hey JustinM89
I tried as you said - i.e. tried logging the it.getValue() - but the runtime array warning launched before the logging executed - I commented out the one line and tried as below
headers.each {
if (it.getKey() == 'Set-Cookie') { // assuming this is a map
// def valueParts = it.getValue().split('=') // Split the value on the equals
log.info (it.getValue())
testRunner.testCase.setPropertyValue(valueParts[0], it.getValue())
}
}
and the returned value were the 4 setcookie values in a comma separated Arraylist as follows:
Tue Jun 18 22:32:20 BST 2019: INFO: [returnurl=41c9c733b4b7ae87cebea0077307969d0b2b6dbe00e140f51d72451b6128c9eb2bc9cefbd881a83d9784c9fe99345c0875a521b73e23c8739ee54ccfa84265c4f0fdaac6b6b55cfc944efd1c07f615d4-870dc80d4da43c6f; Max-Age=3600; Expires=Tue, 18-Jun-2019 22:27:50 GMT; Path=/; Secure; HttpOnly, authtype=61da3a97b24f98368adaef05552f37c3304467f5d2c02d740b244e0d8623d0a1-67c8bfd955a10235; Max-Age=3600; Expires=Tue, 18-Jun-2019 22:27:50 GMT; Path=/; Secure; HttpOnly, state=4128c393917003b9f7a110723aa1a436bfcb4b60f3af5ead5dec55da0cfa5005f9236299dc7294de335ce5906c30805c7f5d236a58899559d67e82262981348a-dfb8e5192d506a03; Max-Age=3600; Expires=Tue, 18-Jun-2019 22:27:50 GMT; Path=/; Secure; HttpOnly, nonce=80989400c4004d4975a29077c7914e75b9ccc2d65408b8aae968f87bce4faf4b-3fbe6f333efd76e3; Max-Age=3600; Expires=Tue, 18-Jun-2019 22:27:50 GMT; Path=/; Secure; HttpOnly]
I sorry - I dont know how to proceed to change the type from list to string - I'm guessing you might throw in a .toString() operator....but that's all my tiny brain can manage..... :)
I did try altering the code to
def headers = testRunner.testCase.testSteps["GET Cookies"].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
def valueParts = (it.getValue()).toString().split('=') //I commented out the above line and replaced it with this one
log.info (valueParts)
testRunner.testCase.setPropertyValue(valueParts[0], it.getValue())
}
}
//def (name, value) = cookies.toString().split('=',2)
// 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...
but I got the following response:
groovy.lang.MissingMethodException: No signature of method: com.eviware.soapui.impl.wsdl.WsdlTestCasePro.setPropertyValue() is applicable for argument types: (java.lang.String, java.util.ArrayList) values: [[returnurl, [returnurl=881d9208ca983dcf9a2cc1971d02a8465eefd47cccdeafb751826e947204b8626f505fa6cf1e06dd9f9ceed91a8f0390dfbdf4077b308be6eb91306b6620ad2fd92d06c68387cddcc87a19c9909218dc-87b5428103f85588; Max-Age=3600; Expires=Tue, 18-Jun-2019 22:58:30 GMT; Path=/; Secure; HttpOnly, ...]] Possible solutions: setPropertyValue(java.lang.String, java.lang.String), getPropertyValue(java.lang.String) error at line: 5
indicating quite conclusively that Im not a groovy developer :)
As always - any help is mightily appreciated
Thanks guys,
rich