doulai6469 2013-08-16 12:06
浏览 93
已采纳

Jenkins(使用Ant)不执行PHPUnit测试

I'm trying to use Jenkins with Ant in my PHP application (Symfony2) but can't get my tests execute. I can see in Jenkins 'console output' screen that the correct configuration file is being read, but it shows that no tests are executed.

When I run the Ant build.xml file in the cli from my project's root directory, the build is successful and my tests execute and pass.

If I cd into the /Users/Shared/Jenkins/{...}/workspace directory and run 'sudo ant', it says no tests executed! which is baffling as the exact same build.xml file executes the tests when run from my project root directory.

The relevant portion of my buil.xml file is:

<target name="phpunit" description="Run unit tests with PHPUnit">
    <exec executable="phpunit" failonerror="true">
        <arg value="-c" />
        <arg path="${workspace}/app/phpunit.xml.dist" />
    </exec>
</target>

app/phpunit.xml looks like:

<?xml version="1.0" encoding="UTF-8"?>

<!-- http://www.phpunit.de/manual/current/en/appendixes.configuration.html -->
<phpunit
        backupGlobals               = "false"
        backupStaticAttributes      = "false"
    colors                      = "true"
    convertErrorsToExceptions   = "true"
    convertNoticesToExceptions  = "true"
    convertWarningsToExceptions = "true"
    processIsolation            = "false"
    stopOnFailure               = "false"
    syntaxCheck                 = "false"
    bootstrap                   = "bootstrap.php.cache" >

<testsuites>
    <testsuite name="Project Test Suite">
        <directory>../src/*/*Bundle/Tests</directory>
    </testsuite>
</testsuites>

<filter>
    <whitelist>
        <directory>../src</directory>
        <exclude>
            <directory>../src/*/*Bundle/Resources</directory>
            <directory>../src/*/*Bundle/Tests</directory>
            <directory>../src/*/Bundle/*Bundle/Resources</directory>
            <directory>../src/*/Bundle/*Bundle/Tests</directory>
        </exclude>
    </whitelist>
</filter>


<logging>
    <log type="coverage-html" target="build/coverage" title="GMS" charset="UTF-8" yui="true" highlight="true"
         lowUpperBound="35" highLowerBound="70"/>
    <log type="coverage-clover" target="build/logs/clover.xml"/>
    <log type="junit" target="build/logs/junit.xml" logIncompleteSkipped="false"/>
</logging>
</phpunit>

I have the Jenkins Clover, Jenkins Clover PHP and xUnit plugins installed.

The relevant portion of the console output from Jenkins is:

phpunit:
 [exec] PHPUnit 3.7.24 by Sebastian Bergmann.
 [exec] 
 [exec] Configuration read from /Users/Shared/Jenkins/Home/jobs/GMS/workspace/app/phpunit.xml.dist
 [exec] 
 [exec] 
 [exec] 
 [exec] Time: 181 ms, Memory: 2.50Mb
 [exec] 
 [exec] [30;43m[2KNo tests executed!
 [exec] [0m[2K
 [exec] Generating code coverage report in Clover XML format ... done
 [exec] 
 [exec] Generating code coverage report in HTML format ... done
  • 写回答

1条回答 默认 最新

  • ds2128629 2013-08-16 12:39
    关注

    It helps if you commit your tests. You fool.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站
  • ¥50 成都蓉城足球俱乐部小程序抢票
  • ¥15 yolov7训练自己的数据集
  • ¥15 esp8266与51单片机连接问题(标签-单片机|关键词-串口)(相关搜索:51单片机|单片机|测试代码)
  • ¥15 电力市场出清matlab yalmip kkt 双层优化问题
  • ¥30 ros小车路径规划实现不了,如何解决?(操作系统-ubuntu)