I have a situation where we are using jersey client to request for updating a project specific database value and once this is completed, we assert the response to be a HTTP.OK. A subsequent API invocation is performed to check if the value has been updated and used for assertion. The steps are:
- Invoke a post/get call - For actions say adding a comment
- Assert for a HTTP.OK on the response which is received immediately
- Assert for the action for which the post/get call was invoked using appropriate methods to check say, comment has been updated
Issue now is that this flow passes when we run the test individually, but in an environment, where there are parallel tests which are running (I am talking about close to 8000 tests) it is seen that the step 2 assertion passes but the step 3 assertion fails intermittently.
I am suspecting that the server is handling the request asynchronously and the step 2 assertion of HTTP.OK does not essentially mean that the comment was updated successfully. This may be because the assertion was performed much before the backend could complete the update.
We have seen that adding a sleep between step 2 and 3 has helped, but is there any cleaner way to handle this? I cannot give details if the server side code uses @Suspended to handle this process as I do not have access to the code.
Do comment in if you feel that the information is inadequate, I am starting on jersey for the first time and may not have expressed the problem accurately.
Aucun commentaire:
Enregistrer un commentaire