Forum Discussion
Hi,
I saw this post on Stack Overflow, and I've read it here. I'm still not sure what the flow of your tests is.
Here's how I understand it...
- You POST an image and get a unique id indicating the id of the image
- You call DELETE, use the id from Step One and image is deleted
- You call DELETE a second using the id from Step One and the response is 'id does not exist'.
I'd say above behaviour is right and the issue you're seeing is more to do with the way you're organising your test(s). I think I can help, but I have to understand your test flow and and how you're organising your tests.
The bit I struggle with is the 'second' run. Do you the whole Test Suite twice? Or just call DELETE twice?
E.g.
Whole Suite twice:-
First Pass
- You POST an image and get a unique id indicating the id of the image
- You call DELETE, use the id from Step One and image is deleted
Second Pass
- You POST an image and get a unique id indicating the id of the image
- You call DELETE, use the id from Step One and image is deleted
Delete Called Twice
- You POST an image and get a unique id indicating the id of the image
- You call DELETE, use the id from Step One and image is deleted
- You call DELETE a second using the id from Step One and the response is 'id does not exist'.
Can you provide some screenshots of how your tests are organised and clarify what you're doing a little further? There's a lot of really, really good and skilled people on this site and i'm sure once the flow is clearer, you'll get a solution.
- richie4 years agoCommunity HeroChrisAdams
I was just about to ask the same questions!
Nice layout/explanation on your points fella,
Rich- ChrisAdams4 years agoChampion Level 3
Cheers richie . By the way, Happy New Year.
- richie4 years agoCommunity Hero
- AsadGilani4 years agoOccasional Contributor
ChrisAdams: Thanks for your reply. I tried with your solutions and it seems that approach is correct but I got some swagger compliance assertion error.
Let me write my workflow
step1: I called my POST method with some data to upload that return successfully with no error.
Step2: I tried to GET that data based on the unique Id which is generated by the POST method as suggested by you I used the value POST response Id in GET method.
Error in the step: Swagger Compliance Assertion -> No resource that matches the OpenAPI definition.Step3: I tried to Delete that data based on the unique Id which is generated by the POST method as suggested by you I used the value POST response Id in DELETE method.
Error : Valid HTTP Status codes - > Response status code 405.
Error :Swagger Compliance Assertion-> No resource that matches the OpenAPI definition.
For me its totally strange because if I am passing the unique id directly then it deletes successfully.
I am using the latest version of ReadyAPI 3.5.1- ChrisAdams4 years agoChampion Level 3
Hi,
How are you passing the id? Are you using Property Transfer to 'pull' the id into the delete step? I see you got some good feedback on Stack Overflow.
It's difficult to see why you are getting a 405 when trying to 'automate' versus testing the hard-coded value with some screenshots.
The only thing I can suggest here is that once you run the test using the method that returns the 405, have a look at the 'raw' tab on the request. The 'raw' tab shows exactly what SoapUI sends to your API. Compare what you see in 'raw' using the working a failing approaches. Hopefully that will show some difference to help you resolve your issue.
- richie4 years agoCommunity HeroHey AsadGilani,
That is weird. Id expect a 404 if the resource wasnt found.....Ive only ever seen a 405 generated when the illegal method was used against the endpoint, i.e. a DELETE method was used against an endpoint that doesnt support a DELETE method.
Did you definitely get a 405 rather than a 404?
This is unlikely, but have you double checked you havent picked up the wrong request when you created that particular test step?
As i say above, if you were getting a 404 that would occur if your transfer wasmt getting the correct id via the prop xfer from the POST to the GET. Are you sure you arent grabbing thr value along with an invisible space character in the prop xfer? This would result in the GET not being successful.
As ChrisAdams suggests you need to check the logging (via the RAW details) on both the POST and the GET, but that wont help for logging on non-executable steps (like a prop xfer).
Have a look in the ReadyAPI log.....this should indicate exactly what value is being picked up.
Are you xferring the value using a prop xfer step along with a properties step? Or are you transferring without a prop xfer step? Or are you xferring with just a prop xfer step?
Youve got an interesting issue to sort out!
Cheers!
Rich- AsadGilani4 years agoOccasional Contributor
richie : Thanks for your reply. Again I will try to explain. it seems that when I try to take the ID(property) from post method then only I am getting the error if I am just passing the ID directly hardcoded I am not getting the error.
Let me write my workflow
step1: I called my POST method with some data to upload that return successfully with no error.
Step2: I tried to GET that data based on the unique Id which is generated by the POST method as suggested by you I used the value POST response Id in GET method.
Error in the step: Swagger Compliance Assertion -> No resource that matches the OpenAPI definition.
Same with the DELETE as I explained in previous comments I am getting 405 when choosing the ID from response of post otherwise if we are passing the ID directly we are not getting 405.
I am also attaching screenshots so that you have a better understanding.
Regards
Asad
Related Content
- 6 years ago
Recent Discussions
- 5 days ago