This morning one of the Jenkins job went red, 5 tests were failing, and it was very difficult to find out which commit caused the break (69 commits were concerned), I used git bisect to run maven tests to find the guilty one. Here is a quick howto:

  • find a stable commit (in my case it was 2ea34cf09cc83804cdcc445476bfb597c617a034)
  • write a short script ( allowing you to run the tests:

mvn -f path/to/my/pom.xml -Dtest=MyTestClass test
  • git bisect start HEAD 2ea34cf09cc83804cdcc445476bfb597c617a034
  • git bisect run ./

That's all, in a few runs (6 in my cases), git found out the commit causing the test failure, a simple git revert and tests were back to green !

comments powered by Disqus