JUnit test failure not failing build



Hi Circle team. Recently I’ve noticed that despite having a JUnit test failure, my build is still marked as successful. This seems like a regression from past behavior where any test breaks would mark the build as broken.

Here is an example branch.

Thank you!



I think this StackOverflow answer will help you.

As the thread mentions, this is a limitation of find, and is suggested to pipe to xargs if you care about the exit status code (as is the case in CI).

From the find(1) manpage:

find exits with status 0 if all files are processed successfully, greater than 0 if errors occur. This is deliberately a very broad description, but if the return value is non-zero, you should not rely on the correctness of the results of find.

Best, Zak


Thanks Zak!

In my case, I was piping test output to the tee command - and tee was always returning a 0 exit code! Major facepalm.

I’ve since stopped using tee and instead redirect all test class output to individual files using maven-surefire-plugin's redirectTestOutputToFile setting. This keeps the console output nice and brief, but I can still research stdout in the event of a break, and CI correctly reports failures.