One of the practice many companies follow is to repeat unstable test until is passes x times (in a row or in total). If it is executed n times and fail to pas
if you are running tests via Maven, with Surefire you care re-run failing tests automatically by using rerunFailingTestsCount.
However, as of 2.21.0, that does not work for JUnit 5 (only 4.x). But hopefully it will be supported in the next releases.