Php 如何使用phing评估junit.xml

Php 如何使用phing评估junit.xml,php,cakephp,junit,phpunit,phing,Php,Cakephp,Junit,Phpunit,Phing,我正在使用phing构建我的CakePHP web应用程序 我想要一个phing目标,沿着以下路线: 运行测试套件 如果出现1次故障,则结束phing目标 如果一切正常,请运行命令“git commit-a” 对于我的测试套件,我遵循使用PHPUnit的CakePHP约定 ${cake} testsuite ${runinworkspaceapp} app AllTests --log-junit ${builddir}/logs/junit.xml 在哪里 ${cake}只是指${appd

我正在使用phing构建我的CakePHP web应用程序

我想要一个phing目标,沿着以下路线:

  • 运行测试套件
  • 如果出现1次故障,则结束phing目标
  • 如果一切正常,请运行命令“git commit-a”
  • 对于我的测试套件,我遵循使用PHPUnit的CakePHP约定

    ${cake} testsuite ${runinworkspaceapp} app AllTests --log-junit ${builddir}/logs/junit.xml
    
    在哪里

    • ${cake}
      只是指
      ${appdir}/Console/cake
    • ${runinworkspaceapp}
      表示
      -app${appdir}
    我将生成一个junit.xml文件。下面是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">
    
    
    
    我怀疑我需要评估junit.xml文件以判断是否存在任何错误。我可能错了,还有更好的办法


    如何编写phing目标?蛋糕应该使用
    退出代码退出!=0当至少一个测试失败时,使用
    checkreturn=“true”
    就足够了


    junit.xml
    可以通过phing任务转换为HTML(另请参见):

    
    
    我不明白与HTML的对话如何帮助我通知Phing在出现故障时不要运行
    git commit-a
    。对于exectask,不存在FailOneError,不幸的是,它可以工作,但请将yes更改为true。因为它是布尔型的
    <?xml version="1.0" encoding="utf-8"?>
    <project name="testreport" default="gen-report" basedir=".">
     <target name="gen-report">
      <phpunitreport infile="log.junit.xml"
                     format="frames"
                     todir="html"
                     styledir="/usr/share/php/data/phing/etc/"
                     />
     </target>
    </project>