ant -f build.xml: exec devolvió: 2 con phpunit?
Frecuentes
Visto 5,266 veces
0
Voy a integrar el proyecto PHP con Jenkins seguir este guía.
Aquí está mi build.xml
presentar
Este es de la salida al correr ant -f build.xml
:
phpunit:
[exec] PHPUnit 3.6.10 by Sebastian Bergmann.
[exec] Usage: phpunit [switches] UnitTest [UnitTest.php]
[exec] phpunit [switches] <directory>
[exec] --log-junit <file> Log test execution in JUnit XML format to file.
[exec] --log-tap <file> Log test execution in TAP format to file.
[exec] --log-json <file> Log test execution in JSON format.
[exec] --coverage-clover <file> Generate code coverage report in Clover XML format.
[exec] --coverage-html <dir> Generate code coverage report in HTML format.
[exec] --coverage-php <file> Serialize PHP_CodeCoverage object to file.
[exec] --coverage-text=<file> Generate code coverage report in text format.
[exec] Default to writing to the standard output
[exec] ...
.
Fragmento de la configuración alrededor de la línea 132:
<target name="phpunit" description="Run unit tests with PHPUnit">
<exec executable="phpunit" failonerror="true"/>
</target>
phpunit/PHPUnit está instalado:
pear list -c phpunit
Installed packages, channel pear.phpunit.de:
============================================
Package Version State
File_Iterator 1.3.1 stable
PHPUnit 3.6.10 stable
PHPUnit_MockObject 1.1.1 stable
PHP_CodeBrowser 1.0.2 stable
PHP_CodeCoverage 1.1.2 stable
PHP_Invoker 1.1.0 stable
PHP_Timer 1.0.2 stable
PHP_TokenStream 1.1.3 stable
Text_Template 1.1.1 stable
phpcpd 1.3.5 stable
phploc 1.6.4 stable
Responder a @oers jueves 3 de mayo 20:31:50 TIC 2012:
He editado el archivo build.xml a algo como esto:
<target name="phpunit" description="Run unit tests with PHPUnit">
<exec executable="phpunit" failonerror="true"/>
<arg line="--log-junit ${basedir}/build/logs/phpunit.xml serving" />
</target>
pero nada cambia.
3 Respuestas
2
He editado el archivo build.xml a algo como esto:
Su build.xml tiene un error en la estructura de árbol.
--- build.xml
+++ build.xml.new
@@ -1,4 +1,5 @@
<target name="phpunit" description="Run unit tests with PHPUnit">
- <exec executable="phpunit" failonerror="true"/>
+ <exec executable="phpunit" failonerror="true">
<arg line="--log-junit ${basedir}/build/logs/phpunit.xml serving" />
+ </exec>
</target>
contestado el 15 de mayo de 12 a las 05:05
0
Como puede ver en la salida (Uso: ...), phpunit
necesita algunos argumentos para ejecutarse correctamente. <exec executable="phpunit" failonerror="true"/>
solo imprimirá la ayuda para phpunit
y salir (como llamar phpunit
directamente desde la línea de comandos).
In la guía oficial para phpunit se le dice que ejecute phpunit de esta manera:
<target name="phpunit">
<exec dir="${basedir}" executable="phpunit" failonerror="true">
<arg line="--log-xml ${basedir}/build/logs/phpunit.xml MoneyTest" />
</exec>
</target>
contestado el 03 de mayo de 12 a las 13:05
0
En mi caso, tuve este problema porque configuré un BaseDir de error, el directorio base debe configurarse como la misma ruta del proyecto o la misma ruta de phpunit.xml.dist.
De todos modos, también puede designar la ruta del archivo de configuración de phpunit en build.xml de esta manera
<target name="phpunit">
<exec dir="${basedir}" executable="phpunit" failonerror="true">
<arg line="-c /your/path/to/phpunit.xml.dist" />
<arg line="--log-xml ${basedir}/build/logs/phpunit.xml MoneyTest" />
</exec>
</target>
Respondido 01 Jul 15, 21:07
No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas ant jenkins phpunit or haz tu propia pregunta.
PHPUnit 3.6.10 utiliza el
--log-junit
switch, he estado probando esta opción pero obtuve los mismos resultados. Por favor revisa mi pregunta actualizada. - cuantos@quanta si recibe el mensaje de uso, entonces está proporcionando parámetros incorrectos a phpunit, asegúrese de que el servicio sea un directorio correcto. Probablemente sea solo un problema local con su configuración, que es difícil de analizar de forma remota. - ofertas