If you are doing an integration test or sanity testing for real application endpoints in continuous delivery process where you hot deploy the application and and you want to trigger some checkups and sanity testing part of your delivery pipeline , how you can add retry logic with delay to unit testing and to your integration test ?
Sample app that include a working demo for it at the following :
So I will through about how you can do it :
- We will create annotation to mark the test cases needed to be retried :
- We will create the implementation using JUnit rules option :
- sample of how you can use it :
Then when you execute the test and your endpoint is not reachable right away , it will retry again based into your retry configuration .