Passing the cookie in subsequent requests of SOAP UI
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Passing the cookie in subsequent requests of SOAP UI
We are trying to automate API testing. In our API we will first pass Email and password and fetch the access_token. After generating the access_token we will place the token in some cookie say 'TokenCookie'.
Then this access_token should be passed in the header for calling any of the API methods. On the server side we will validate if the access_token passed in the header and token present in the cookie("TokenCookie") are same.If they are similar we will hit the api method and provide response else we will show 500 error.
The above approach is working fine when we test the api from postman. But in Soap UI the cookie 'TokenCookie' is not passed in the subsequent requests. But when we are fetching token ,in the Raw response we observed that the Cookie is set. We are checking the token in header and cookie, as the cookie is null it is always throwing 500 error.
Could any one help us in passing the cookie for subsequent requests in SOAP UI
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have the same authentication method set up on readyAPI
I first get the token
using property transfer I add it as a property to the project level
In the test step that requires this cookie I add a header
the header is pointing to the project level property 'token' that I have created and populated using the property transfer above
It is working for me.
Use property transfer instead of 'get data' I find it more reliable
Make sure your cookie is transfered correctly - compare your raw data between readyAPI and postman to see the differences and adjust until you make it work
Good luck.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
https://github.com/nmrao/soapUIGroovyScripts/blob/master/groovy/AddCookiesToNextRequest.groovy
Regards,
Rao.
