Search code examples
jenkinscucumbercucumber-javacucumber-junit

How to repeat Jenkins job if it fails


I have Java Cucumber tests running on Jenkins. I would like to achieve something like repeat the job in it fails or even better repeat the Cucumber feature if it fails? I dont see any option to run test multiple times. Is it possible or not?


Solution

  • You can use the retry step

    retry(3) {
       sh './flaky-command.sh'
    }