CruiseControl JUnit 测试结果显示全零

发布于 2024-08-10 21:58:29 字数 3105 浏览 4 评论 0原文

我已经将 JUnit 与 CruiseControl 连接起来,并且正在执行单元测试日志已导入,但 CruiseControl 显示以下输出:(

nz.co.picksend.core.tests.nz.co.picksend.core.dal.FilterTests 
Tests: 0, Failures: 0, Errors: 0, Duration: 0.0
nz.co.picksend.core.tests.nz.co.picksend.core.dal.ModelObjectRegistryTests 
Tests: 0, Failures: 0, Errors: 0, Duration: 0.0
nz.co.picksend.core.tests.nz.co.picksend.core.dal.ModelObjectSetTests 
Tests: 0, Failures: 0, Errors: 0, Duration: 0.0
nz.co.picksend.core.tests.nz.co.picksend.core.humanresources.AllHumanResourcesTests 
Tests: 0, Failures: 0, Errors: 0, Duration: 0.0

注意全部为零)

但是,正在合并的日志文件如下所示:

<?xml version="1.0" encoding="UTF-8" ?>
<testsuite errors="1" failures="0" hostname="maudslay"
    name="nz.co.picksend.core.tests.nz.co.picksend.core.rules.MockEvalRule" tests="1"
    time="0.0" timestamp="2009-11-04T23:05:19">
<properties>
    ...
</properties>
<error message="nz.co.picksend.core.tests.nz.co.picksend.core.rules.MockEvalRule"
    type="java.lang.ClassNotFoundException">
java.lang.ClassNotFoundException:
    nz.co.picksend.core.tests.nz.co.picksend.core.rules.MockEvalRule
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
</error>
<system-out><![CDATA[]]></system-out>
<system-err><![CDATA[]]></system-err>
</testsuite>

这是来自 ant 的 build.xml 的片段:

<target name="test">
    <junit errorProperty="test.failed" failureProperty="test.failed">
    <formatter type="brief" usefile="false" />
        <formatter type="xml" />
        <batchtest todir="${buildresults.dir}">
            <fileset dir="${basedir}">
                <include name="nz.co*/**/tests/**/*.java" />
                <include name="nz.co*/**/test/**/*.java" />
            </fileset>
        </batchtest>
    </junit>
<fail message="Tests failed: check test reports." if="test.failed" />
</target>

最后,这是来自 Cruisecontrol 的 config.xml 的项目片段:

<project requiremodification="false" name="Pick and Send">
    <modificationset QuietPeriod="30">
        ....
    </modificationset>
    <schedule Interval="300" ShowProgress="true">
        <ant AntWorkingDir="E:\Build\PickSend2" 
        BuildFile="E:\Build\PickSend2\build.xml" 
        Time="0400" Target="bat" anthome="apache-ant-1.7.0" />
    </schedule>
    <log>
        <merge Dir="E:\Build\PickSend2\buildresults" />
    </log>
    <bootstrappers>
        ....
    </bootstrappers>
</project>

以前有人遇到过这种情况吗?

I've got JUnit hooked up with CruiseControl and unit tests are being executed & logs imported, but CruiseControl shows the following output:

nz.co.picksend.core.tests.nz.co.picksend.core.dal.FilterTests 
Tests: 0, Failures: 0, Errors: 0, Duration: 0.0
nz.co.picksend.core.tests.nz.co.picksend.core.dal.ModelObjectRegistryTests 
Tests: 0, Failures: 0, Errors: 0, Duration: 0.0
nz.co.picksend.core.tests.nz.co.picksend.core.dal.ModelObjectSetTests 
Tests: 0, Failures: 0, Errors: 0, Duration: 0.0
nz.co.picksend.core.tests.nz.co.picksend.core.humanresources.AllHumanResourcesTests 
Tests: 0, Failures: 0, Errors: 0, Duration: 0.0

(Note all zeroes)

However, the log files that are being merged look like this:

<?xml version="1.0" encoding="UTF-8" ?>
<testsuite errors="1" failures="0" hostname="maudslay"
    name="nz.co.picksend.core.tests.nz.co.picksend.core.rules.MockEvalRule" tests="1"
    time="0.0" timestamp="2009-11-04T23:05:19">
<properties>
    ...
</properties>
<error message="nz.co.picksend.core.tests.nz.co.picksend.core.rules.MockEvalRule"
    type="java.lang.ClassNotFoundException">
java.lang.ClassNotFoundException:
    nz.co.picksend.core.tests.nz.co.picksend.core.rules.MockEvalRule
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
</error>
<system-out><![CDATA[]]></system-out>
<system-err><![CDATA[]]></system-err>
</testsuite>

Here's the snippet from ant's build.xml:

<target name="test">
    <junit errorProperty="test.failed" failureProperty="test.failed">
    <formatter type="brief" usefile="false" />
        <formatter type="xml" />
        <batchtest todir="${buildresults.dir}">
            <fileset dir="${basedir}">
                <include name="nz.co*/**/tests/**/*.java" />
                <include name="nz.co*/**/test/**/*.java" />
            </fileset>
        </batchtest>
    </junit>
<fail message="Tests failed: check test reports." if="test.failed" />
</target>

and finally, here's the project's snippet from cruisecontrol's config.xml:

<project requiremodification="false" name="Pick and Send">
    <modificationset QuietPeriod="30">
        ....
    </modificationset>
    <schedule Interval="300" ShowProgress="true">
        <ant AntWorkingDir="E:\Build\PickSend2" 
        BuildFile="E:\Build\PickSend2\build.xml" 
        Time="0400" Target="bat" anthome="apache-ant-1.7.0" />
    </schedule>
    <log>
        <merge Dir="E:\Build\PickSend2\buildresults" />
    </log>
    <bootstrappers>
        ....
    </bootstrappers>
</project>

Has anyone had this situation before?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

何以笙箫默 2024-08-17 21:58:29

发生这种情况是因为单元测试抛出错误,不是在测试本身中,而是在测试的设置中。由于某种原因,巡航控制系统没有捕获到这一点。

This happened because of the unit test throwing an error, not in the test itself, but in the test's setup. This for some reason isn't captured by cruisecontrol.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文