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.
Not sure I understand why you have made two test suites for the delete endpoint. Nevertheless, a simple solution would be:
#1 Use a single test suite here.
#2 Create one test case, e.g. "Cannot delete an already deleted image". Here you implicitly tests the deletion of an image using the unique ID.
#3 The test case will have 3 requests:
Create image
Delete image using unique ID
Delete image re-using unique ID.
#4 You use Property Transfer between the requests to share the unique ID
This way you will never encounter the problem raised, and you will be testing both the deletion and the attempt to delete the already deleted image.
If for some reason the tests need to be independent of each other, the above solution needs a bit of tweaking :)