jeudi 28 janvier 2016

Is there a way of testing a method's ability to handle concurrent calls?

I have a method which creates an entity in a database table. I want to test the scenario where the method gets invoked twice at the exact same time.

The method has logic to avoid such a scenario and fail one of the 2 requests but I have no way to confirm if that is working correctly.

Is there a way to test this without the test being flaky?

I crudely tried invoking the action simultaneously from 2 browsers but they don't execute in parallel. I suppose that will take a lot of trial and error to get them execute at the exact same time (it's an war file running on tomcat)

Aucun commentaire:

Enregistrer un commentaire