2

A team member of mine recently setup some Hudson continuous-integration builds for a number of our development code bases. It uses the built in ant integration configured in simple way.

While, it is very helpful and I recommend it strongly, I was wondering how to get more more concise/informative/useful emails instead of just the tail of the ant build log.

E.G., Don't want this:

> [...truncated 36530 lines...]
>     [junit] Tests run: 32, Failures: 0, Errors: 0, Time elapsed: 0.002 sec
... (hundred of lines omitted) ...
>     [junit] Tests run: 10, Failures: 0, Errors: 0, Time elapsed: 0.001 sec
>     [junit] Tests FAILED
>
> BUILD FAILED

I assume, that I could skip the build-in ant support and send the build log through a grep script, but I was hoping there was a more integrated or elegant option.

4

1 に答える 1

1

あなたがすでにこれを行っているかどうかはわかりませんが、アリのテスト タスクの次のスニペットが役立つと思います。

<target name="test" depends="test.compile" description="runs junit tests">

        <taskdef name="junit"
            classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask"
            classpath="${script.dir}/tools/ant-junit.jar"/>

        <junit haltonfailure="no" printsummary="on" fork="yes">
            <classpath>
                 <path refid="web.classpath.compile"/>
                 <pathelement location="${test.build.dir.classes}"/>
                 <pathelement location="${web.build.dir.classes}"/>
            </classpath>
            <formatter type="brief" usefile="false"/>
            <formatter type="xml"/>
            <batchtest todir="${script.dir}/test-results">
                <fileset dir="${test.build.dir.src}"
                        includes="**/*Test.java"/>
            </batchtest>
        </junit>
    </target>

この構成では、ant-junit.jar パッケージにある「org.apache.tools.ant.taskdefs.optional.junit.JUnitTask」によって実装される「junit」タスクを作成しています。

その後、ターゲットを直接呼び出して xml フォーマッタを設定します。

Hudson も使用しており、最近失敗したビルドの URL を送信するだけで、そこから、AssertionFailedError のトレースを使用して、前述のタスクによって生成されたテスト結果にアクセスできます。

それが役に立てば幸い。

カルロス

于 2008-11-26T09:21:19.640 に答える