gpt4 book ai didi

php - Jenkins(使用Ant)未执行PHPUnit测试

转载 作者:行者123 更新时间:2023-12-02 06:36:11 26 4
gpt4 key购买 nike

我试图在我的PHP应用程序(Symfony2)中将Jenkins与Ant结合使用,但无法执行测试。我在Jenkins的“控制台输出”屏幕中看到正在读取正确的配置文件,但是它表明没有执行任何测试。

当我从项目的根目录在cli中运行Ant build.xml文件时,构建成功,并且我的测试得以执行并通过。

如果我进入/Users/Shared/Jenkins/{...}/workspace目录并运行'sudo ant',它说没有执行任何测试!当从我的项目根目录运行时,由于完全相同的build.xml文件执行测试而令人困惑。

我的buil.xml文件的相关部分是:

<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看起来像:
<?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>

我安装了Jenkins Clover,Jenkins Clover PHP和xUnit插件。

Jenkins控制台输出的相关部分是:
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

最佳答案

如果您提交测试,将会有所帮助。你这个傻瓜。

关于php - Jenkins(使用Ant)未执行PHPUnit测试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18272971/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com