I am using phing to build my CakePHP web application.
I want to have a phing target that goes along these lines:
- Run the test suite
- if there is even 1 failure, end the phing target
- if all okay, run the command "git commit -a"
For my test suite, I follow the CakePHP convention which uses PHPUnit
${cake} testsuite ${runinworkspaceapp} app AllTests --log-junit ${builddir}/logs/junit.xml
where
${cake}
simply means${appdir}/Console/cake
${runinworkspaceapp}
means-app ${appdir}
I will generate a junit.xml file. Below is a snippet of the junit.xml
<testsuites>
<testsuite name="All Tests" tests="44" assertions="373" failures="0" errors="0" time="4.634020">
<testsuite name="All Model related class tests" tests="42" assertions="370" failures="0" errors="0" time="4.478717">
I suspect that I need to evaluate the junit.xml file in order to tell whether there is any error. I could be wrong and there is a better way.
How do I write the phing target?