With the new Maven Surefire option rerunFailingTestsCount, all the failed tests can be automatically re-run immediately after their failures in place. When setting this parameter to a value K larger than 0, all the failed tests will be re-run up to K times until they pass. Any failed test passes in the subsequent re-run will be count as a flaky test.