cancel
Showing results for 
Search instead for 
Did you mean: 

ReadyAPI Functional Testing Automate Problem

AsadGilani
Occasional Contributor

ReadyAPI Functional Testing Automate Problem

I am writing the test suite for my endpoints.I am having one problem which is for running the 1 test suite twice. For Example, When I add an image with endpoints it adds the Image with a unique Id and returns successfully. This unique Id is generated new every time. So we have another endpoint where we pass unique IDs to delete. So it is successful for the first time but when we run the delete second time the same query then that id is deleted and it says it does not exists. how do we automate this thing? I mean the test case should not fail.

I tried to search but could not able to find any resource, Any help will be appreciated. Thanks.

13 REPLIES 13
ChrisAdams
Contributor

Re: ReadyAPI Functional Testing Automate Problem

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.

 

richie
Community Hero

Re: ReadyAPI Functional Testing Automate Problem

@ChrisAdams

I was just about to ask the same questions!

Nice layout/explanation on your points fella,

Rich
if this helped answer the post, could you please mark it as 'solved'? Also if you consider whether the title of your post is relevant? Perhaps if the post is solved, it might make sense to update the Subject header field of the post to something more descriptive? This will help people when searching for problems. Ta
ChrisAdams
Contributor

Re: ReadyAPI Functional Testing Automate Problem

Cheers @richie .  By the way, Happy New Year.

richie
Community Hero

Re: ReadyAPI Functional Testing Automate Problem

@ChrisAdams,

Back atcha fella!

Rich
if this helped answer the post, could you please mark it as 'solved'? Also if you consider whether the title of your post is relevant? Perhaps if the post is solved, it might make sense to update the Subject header field of the post to something more descriptive? This will help people when searching for problems. Ta
AsadGilani
Occasional Contributor

Re: ReadyAPI Functional Testing Automate Problem

@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



ChrisAdams
Contributor

Re: ReadyAPI Functional Testing Automate Problem

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.

richie
Community Hero

Re: ReadyAPI Functional Testing Automate Problem

Hey @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
if this helped answer the post, could you please mark it as 'solved'? Also if you consider whether the title of your post is relevant? Perhaps if the post is solved, it might make sense to update the Subject header field of the post to something more descriptive? This will help people when searching for problems. Ta
AsadGilani
Occasional Contributor

Re: ReadyAPI Functional Testing Automate Problem

@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

AsadGilani
Occasional Contributor

Re: ReadyAPI Functional Testing Automate Problem

No updates on my previous reply yet. If someone has any idea please reply.

New Here?
Join us and watch the welcome video:
Top Kudoed Authors