Jenkins上的Zend Framework 2单元测试不起作用
我有一个zend framework 2项目,我正在尝试设置我的jenkins,以便可以执行单元测试。Jenkins在ubuntu上运行,我在Windows7下使用PHPStorm进行开发 build.xmlJenkins上的Zend Framework 2单元测试不起作用,jenkins,phpunit,zend-framework2,Jenkins,Phpunit,Zend Framework2,我有一个zend framework 2项目,我正在尝试设置我的jenkins,以便可以执行单元测试。Jenkins在ubuntu上运行,我在Windows7下使用PHPStorm进行开发 build.xml <target name="phpunit" description="Run unit tests with PHPUnit"> <exec executable="phpunit" failonerror="true"> <arg
<target name="phpunit" description="Run unit tests with PHPUnit">
<exec executable="phpunit" failonerror="true">
<arg value="${basedir}/module/Addressbook/test"/>
</exec>
</target>
文件夹结构:
- 计划
- 模块
- 通讯录
- 试验
- 地址簿测试
- 控制器
- AddressbookControllerTest.php
- Boostrap.php
- phpunit.xml.dist
- TestConfig.php
- 控制器
- 地址簿测试
- build.xml
- 模块
我如何将其用于jenkins?看起来您的include路径设置不正确,如果有更好的选项,我不会将exec直接用于PHPUNIT 你应该和Jenkins一起研究使用PHING任务,它们一起工作非常出色 然后,设置Jenking以触发PHING目标,通过PHPUNIT任务为您运行单元测试,例如PHPUNIT的PHING目标:
<target name="phpunit">
<phpunit bootstrap="${srcdir}/tests/bootstrap.php">
<formatter todir="${builddir}/reports" type="xml"/>
<batchtest>
<fileset dir="${srcdir}/tests">
<include name="**/*Test*.php"/>
<exclude name="**/Abstract*.php"/>
<exclude name="${srcdir}/vendor/**"/>
</fileset>
</batchtest>
</phpunit>
<!--
Generate a report from the XML data created..
note: error when using format="frames"
-->
<phpunitreport infile="${builddir}/reports/testsuites.xml"
format="noframes"
todir="${builddir}/reports/tests"
/>
</target>
我帮不了你。但是要从其他人那里得到帮助,他们肯定需要你的引导代码。这个错误是不言自明的,找不到类。这表明您的引导失败/错误。我已经修复了它,谢谢:)成功了
<target name="phpunit">
<phpunit bootstrap="${srcdir}/tests/bootstrap.php">
<formatter todir="${builddir}/reports" type="xml"/>
<batchtest>
<fileset dir="${srcdir}/tests">
<include name="**/*Test*.php"/>
<exclude name="**/Abstract*.php"/>
<exclude name="${srcdir}/vendor/**"/>
</fileset>
</batchtest>
</phpunit>
<!--
Generate a report from the XML data created..
note: error when using format="frames"
-->
<phpunitreport infile="${builddir}/reports/testsuites.xml"
format="noframes"
todir="${builddir}/reports/tests"
/>
</target>