【发布时间】:2011-01-09 16:34:19
【问题描述】:
我正在尝试使用 xUnit 插件将我的 PHPUnit 测试集成到 Hudson 中。在 hudson 中使用 Ant 成功构建后,控制台输出显示:
记录测试结果
没有任何测试报告包含任何结果
我使用 phpunit --log-junit 的 junit.xml 测试输出如下:
<testsuites>
<testsuite name="Unit Tests" tests="1" assertions="1" failures="0" errors="0" time="0.005112">
<testsuite name="DbTest" file="src/tests/unit/DbTest.php" tests="1" assertions="1" failures="0" errors="0" time="0.005112">
<testcase name="testConnection" class="DbTest" file="src/tests/unit/DbTest.php" line="4" assertions="1" time="0.005112"/>
</testsuite>
</testsuite>
</testsuites>
感谢任何帮助
编辑: 我刚刚创建了一个测试 junit.xml,其中包含:
<testsuites>
<testsuite name="DbTest" file="src/tests/unit/DbTest.php" tests="1" assertions="1" failures="0" errors="0" time="0.005112">
<testcase name="testConnection" class="DbTest" file="src/tests/unit/DbTest.php" line="4" assertions="1" time="0.005112"/>
</testsuite>
</testsuites>
有了这个,构建就成功了。问题似乎是嵌套的标签。知道如何防止 PHPUnit 创建这些嵌套标签吗?
【问题讨论】: