readyAPI feature - automatic passing cookies to following request with “Maintain HTTP Session”
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
readyAPI feature - automatic passing cookies to following request with “Maintain HTTP Session”
I'm on ReadyAPI 3.9.0 (trial).
Have seen documentation and tried to use “Maintain HTTP Session” https://www.soapui.org/docs/soapui-projects/form-based-authentication/#_ga=2.117081990.1241344506.16...and other questions on the https://community.smartbear.com/t5/SoapUI-Open-Source/
I use Add a Header with a key name Cookie to a Request and set the Value to
${REST login#HarResponse#$['headers'][5]['value']}
to get auth cookies in the request headers.
But the order of the Headers in the HarResponse json is not constant and [5] in my case is a variable list element index that is not comfortable during automated tests.
Groovy scripting is ok but again to repeat a script for each step is inconvenient and boring in comparison with Postman or a web browser style of normal (automatic) Set-Cookie.
More over the manual adding a Cookie section to the request headers doesn’t allow the testers (for which readyAPI has been developed) to test a “Set cookies” workflow that is not good for the specialized software that is readyAPI.
It looks like many things for start working with or migrating to readyAPI were not in a focus in the documentation...
Could you show me the easiest way to automate Set-Cookie as a result of a server response or tell me where I’m wrong with “Maintain HTTP Session” option? Hope the issue is not the case of a trial version.
Solved! Go to Solution.
- Labels:
-
Automation Environments
-
REST
-
Scripting
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
https://github.com/nmrao/soapUIGroovyScripts/blob/804652073a8e7c1259bc567c7bf3d2a71e2f4254/groovy/sc...
Regards,
Rao.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Update. To those who are switching from Postman.
A readyAPI feature.
Automation with “Maintain HTTP Session” works fine ONLY when one runs test steps as a Test Case and doesn't work when running test steps one-by-one (for example if you try debugging a test step like in Postman). For the debug purpose in “Maintain HTTP Session” mode there are a "bug" button (next to a run button under the TestCase name) and a "Step-by-Step Run" tab.
There is lack of warnings for the feature in the docs. A lot of time has been wasted to get it worked.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for the link @nmrao. I've already googled this solution and that is exactly I have mentioned in my root post (about Groovy script).
@nmrao wrote:
Please see if the below link helps
https://github.com/nmrao/soapUIGroovyScripts/blob/804652073a8e7c1259bc567c7bf3d2a71e2f4254/groovy/sc...
But the question is simple how to debug or write a Test Case with “Maintain HTTP Session” having a bunch of test steps in a serie??? May be the answer is too simple...
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I dont know if ive misunderstood, but from what youve said, it sounds like the "maintain http session" checkbox isnt working properly.
The script @nmrao mentioned or one very similar, he actually put together for me a while back when i had to do this. Immediately after he'd coded it i discovered the maintain http session option. It did and should identify the set-cookie header from a request's response and then add >= cookie (relative to how many ; separated values were sent on the set-cookie) to all other requests hitting the same domain.
Is this not happening with you?
Cheers
Rich
