Rerun flaky JUnit test in case they failed

后端 未结 2 612
天涯浪人
天涯浪人 2021-01-26 23:29

I have a job A in Jenkins for my automated testing that is triggered if another job B build is successful. The job A run several tests. Some of the test are flaky so I would lik

2条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-26 23:48

    I would suggest to fix your tests or rewrite them so they will only fail if something is broken. Maybe you can mock away the things that tend to fail. If you are depnending on a database connection, maybe you could use a sqlite or smething which is local.

    But there is also a plugin which can retry a build: https://wiki.jenkins-ci.org/display/JENKINS/Naginator+Plugin

    Simply install the plugin, and then check the Post-Build action "Retry build after failure" on your project's configuration page.

    If you want to rerun tests in JUnit-context, take a look here: SO: How to Re-run failed JUnit tests immediately?

提交回复
热议问题