jeudi 28 janvier 2016

How to make Jenkins fail the build of zero tests were run (due to configuration error)

I have a Jenkins job that runs javascript unit tests (jasmine + karma). The result of that step is a JUnit-compatible XML file.

I have configured a post-build action using the `` Publish xUnit test result report` plugin, which can handle a variety of test result formats, including JUnit.

It usually works fine, if there are some failed tests, this step fails the build.

...But it doesn't fail the build in case of catastrophic failure: if there is an error so bad in the web app that no tests are run at all, the xml result file will happily look like

<testsuite />

... meaning there are zero tests, meaning there are zero failed tests, meaning everything is peachy! Now that's a false positive if I ever saw one.

How can I configure Jenkins / the xUnit reports plugin / ... to take this failure case into account?

FWIW: we use bower to manage the JS modules we use, and its config file had an error, so no 3rd party deps were downloaded for our Angular app, including the Angular package.

Aucun commentaire:

Enregistrer un commentaire