unit testing - phpUnit & Ant unrecognized option --log-xml -


i trying automate testing procedure using ant. error:

test: phpunit 3.5.0 sebastian bergmann.  unrecognized option --log-xml /var/www/nrka2/build/build.xml:30: exec returned: 1 build failed (total time: 1 second) 

and build.xml

<?xml version="1.0" encoding="utf-8"?> <project name="eventmanager" default="build" basedir="../">      <target name="getprops">         <property file="${basedir}/build/ant.properties" />          <condition property="script-suffix" value="" else="">             <os family="unix" />         </condition>          <echo message="---- build properties ----" />         <echo message="" />           <echo message="os ${os.name}" />         <echo message="basedir ${basedir}" />         <echo message="property file ${basedir}/build/ant.properties" />         <echo message="script-suffix ${script-suffix}" />          <echo message="" />         <echo message="---- eventmanager properties ----" />         <echo message="" />          <echo message="environment ${environment}" />      </target>      <target name="test" depends="getprops">         <exec dir="${basedir}/tests" executable="phpunit${script-suffix}"             failonerror="true">             <arg line="--colors --coverage-html ${basedir}/build/report              --log-xml ${basedir}/build/logs/phpunit.xml               --log-pmd ${basedir}/build/logs/phpunit.pmd.xml              --log-metrics ${basedir}/build/logs/phpunit.metrics.xml              --coverage-xml ${basedir}/build/logs/phpunit.coverage.xml               alltests.php" />         </exec>     </target>      <target name="configure" depends="getprops">         <copy file="${basedir}/application/application.php.dist" tofile="${basedir}/application/application.php"             overwrite="true" />         <replace file="${basedir}/application/application.php" token="@environment@"             value="${environment}" />      </target>      <target name="buildpreparation">         <mkdir dir="${basedir}/build/logs" />         <mkdir dir="${basedir}/build/report" />     </target>      <target name="clean">         <delete dir="${basedir}/build/logs" />         <delete dir="${basedir}/build/report" />     </target>      <target name="deploy">         <echo message="---- removing require_once ----" />         <replaceregexp byline="true">             <regexp pattern="require_once 'zend/" />             <substitution expression="// require_once 'zend/" />             <fileset dir="${basedir}/library/zend" excludes="**/*autoloader.php"                 includes="**/*.php" />         </replaceregexp>     </target>      <target name="build" depends="buildpreparation,configure,test" /> </project> 

can me solve problem?

phpunit 3.5.0 not take --log-xml argument. here available options output --help command:

$ phpunit --help phpunit 3.5.0 sebastian bergmann.  usage: phpunit [switches] unittest [unittest.php]        phpunit [switches] <directory>    --log-junit <file>       log test execution in junit xml format file.   --log-tap <file>         log test execution in tap format file.   --log-dbus               log test execution dbus.   --log-json <file>        log test execution in json format.    --coverage-html <dir>    generate code coverage report in html format.   --coverage-clover <file> write code coverage data in clover xml format.    --story-html <file>      write story/bdd results in html format file.   --story-text <file>      write story/bdd results in text format file.    --testdox-html <file>    write agile documentation in html format file.   --testdox-text <file>    write agile documentation in text format file.    --filter <pattern>       filter tests run.   --group ...              runs tests specified group(s).   --exclude-group ...      exclude tests specified group(s).   --list-groups            list available test groups.    --loader <loader>        testsuiteloader implementation use.   --repeat <times>         runs test(s) repeatedly.    --story                  report test execution progress in story/bdd format.   --tap                    report test execution progress in tap format.   --testdox                report test execution progress in testdox format.    --colors                 use colors in output.   --stderr                 write stderr instead of stdout.   --stop-on-error          stop execution upon first error.   --stop-on-failure        stop execution upon first error or failure.   --stop-on-skipped        stop execution upon first skipped test.   --stop-on-incomplete     stop execution upon first incomplete test.   --strict                 mark test incomplete if no assertions made.   --verbose                output more verbose information.   --wait                   waits keystroke after each test.    --skeleton-class         generate unit class unittest in unittest.php.   --skeleton-test          generate unittest class unit in unit.php.    --process-isolation      run each test in separate php process.   --no-globals-backup      not backup , restore $globals each test.   --static-backup          backup , restore static attributes each test.   --syntax-check           try check source files syntax errors.    --bootstrap <file>       "bootstrap" php file run before tests.   --configuration <file>   read configuration xml file.   --no-configuration       ignore default configuration file (phpunit.xml).   --include-path <path(s)> prepend php's include_path given path(s).   -d key[=value]           sets php.ini value.    --help                   prints usage information.   --version                prints version , exits. 

you should use --log-junit instead.

note there no --log-pmd, --log-metrics or --coverage-xml options you'll need change these too.

check out this following github link regarding switches removed phpunit:

  • --log-pmd , --log-metrics have been removed described here intention corresponding functionality moved php_depend , phpmd
  • use --coverage-clover instead of --coverage-xml

hope helps!


Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -