lundi 8 octobre 2018

REST-Assured fail tests when there is a delay

I've built a RESTful API in Java using JaxRS/Jersey to test several services/databases offered on IBM Cloud.

To test the API, I'm using REST-Assured and created ~15 tests. I use Maven to spin up a Jetty server, run the tests with the failsafe plugin, then close the server.

Everything is fine until it gets to an endpoint that has any sort of delay in it such as a Thread.sleep or anything that creates a new Thread. This is the pattern I am witnessing. The endpoint fails ~80% of the time.

Does anyone know why having a Thread.sleep or new Thread in the logic causes this behavior and if so, any way to get around this other than ignoring the test?

Thanks!

Aucun commentaire:

Enregistrer un commentaire