Search code examples
unit-testingcakephpjenkinsphing

Phing keeps building despite failures of CakePHP unit testing


we do deployment using Jenkins job and Phing for builds. Our app is made on CakePHP. When I run Cake unit tests I got some errors (as expected).

/app/Console/cake test app AllQaTests --stderr --log-junit

But Phing doesn't perceive them and keeps building instead of stopping the process and marking the build as failed. Is there any elegant way of handling output of tests?

Now we use a separate script which scans test log and seeks for "FAILURE" word.


Solution

  • If your cake command outputs anything other than 0, it would be considered FAILURE by Jenkins, and the job will be marked accordingly.

    To answer your question for searching console log for keywords, there is Text-finder plugin that allows to search console log and/or any other file for a RegEx, and mark the build as UNSTABLE or FAILED if found.