alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Ant example source code file (junitreport.xml)

This example Ant source code file (junitreport.xml) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Ant tags/keywords

iso-8859-1, iso-8859-1

The junitreport.xml source code

<?xml version="1.0" encoding="ISO-8859-1"?>

<project name="junitreport-test" basedir="." default="reports">

    <property name="jrdir" location="junitreport"/>
    <property name="outputdir" location="${jrdir}/test"/>

    <!-- reports1 take care of transformation of 2 test result files and
         produce reports according to the default format (frames)
         needed for testNoFileJunitNoFrames -->
    <target name="reports1">
        <mkdir dir="${outputdir}"/>
        <mkdir dir="${outputdir}/html"/>
        <junitreport todir="${outputdir}">
            <fileset dir="${jrdir}">
                <include name="TEST-*.xml"/>
            </fileset>
            <report todir="${outputdir}/html"/>
        </junitreport>
    </target>

    <target name="testEmptyFile">
        <mkdir dir="${outputdir}/html"/>
        <junitreport todir="${outputdir}">
            <fileset dir="${jrdir}">
                <include name="ZEROBYTES-*.xml"/>
                <include name="TEST-*.xml"/>
            </fileset>
            <report todir="${outputdir}/html"/>
        </junitreport>
    </target>

    <target name="testIncompleteFile">
        <mkdir dir="${outputdir}/html"/>
        <junitreport todir="${outputdir}">
            <fileset dir="${jrdir}">
                <include name="INCOMPLETE-*.xml"/>
                <include name="TEST-*.xml"/>
            </fileset>
            <report todir="${outputdir}/html"/>
        </junitreport>
    </target>

    <target name="testWrongElement">
        <mkdir dir="${outputdir}/html"/>
        <junitreport todir="${outputdir}">
            <fileset dir="${jrdir}">
                <include name="WRONGELEMENT-*.xml"/>
                <include name="TEST-*.xml"/>
            </fileset>
            <report todir="${outputdir}/html"/>
        </junitreport>
    </target>

    <target name="testNamespace">
        <mkdir dir="${outputdir}/html"/>
        <junitreport todir="${outputdir}">
            <fileset dir="${jrdir}">
                <include name="NAMESPACE-*.xml"/>
                <include name="TEST-*.xml"/>
            </fileset>
            <report todir="${outputdir}/html"/>
        </junitreport>
    </target>

    <target name="clean">
        <delete dir="${outputdir}"/>
    </target>

    <target name="testStackTraceLineBreaks">
        <mkdir dir="${outputdir}/html"/>
        <junitreport todir="${outputdir}">
            <fileset dir="${jrdir}">
                <include name="TEST-*.xml"/>
            </fileset>
            <report todir="${outputdir}/html"/>
        </junitreport>
    </target>

    <target name="testSpecialSignsInSrcPath">
        <mkdir dir="${outputdir}/html"/>
        <mkdir dir="${outputdir}/test# $$%§&-!cases"/>
        <copy todir="${outputdir}/test# $$%§&-!cases">
            <fileset dir="junitreport" includes="TEST-*.xml"/>
        </copy>
        <junitreport todir="${outputdir}/html">
            <fileset dir="${outputdir}/test# $$%§&-!cases">
                <include name="TEST-*.xml"/>
            </fileset>
            <report todir="${outputdir}/html"/>
        </junitreport>
    </target>

    <target name="testSpecialSignsInHtmlPath">
        <mkdir dir="${outputdir}/html# $$%§&-!report"/>
        <mkdir dir="${outputdir}/test"/>
        <copy todir="${outputdir}/test">
            <fileset dir="junitreport" includes="TEST-*.xml"/>
        </copy>
        <junitreport todir="${outputdir}/html# $$%§&-!report">
            <fileset dir="${outputdir}/test">
                <include name="TEST-*.xml"/>
            </fileset>
            <report todir="${outputdir}/html# $$%§&-!report"/>
        </junitreport>
    </target>

    <target name="testWithStyleFromClasspath">
        <mkdir dir="${outputdir}/html"/>
        <junitreport todir="${outputdir}">
            <fileset dir="${jrdir}">
                <include name="TEST-*.xml"/>
            </fileset>
            <report todir="${outputdir}/html"/>
        </junitreport>
    </target>

    <target name="testNoFrames">
        <mkdir dir="${outputdir}/html"/>
        <junitreport todir="${outputdir}">
            <fileset dir="${jrdir}">
                <include name="TEST-*.xml"/>
            </fileset>
            <report todir="${outputdir}/html" format="noframes"/>
        </junitreport>
    </target>

    <target name="testWithStyleFromDir">
        <mkdir dir="${outputdir}/html"/>
        <junitreport todir="${outputdir}">
            <fileset dir="${jrdir}">
                <include name="TEST-*.xml"/>
            </fileset>
            <report todir="${outputdir}/html"
                styledir="junitreport"
                format="frames"/>
        </junitreport>
    </target>

    <!-- bug report 40022 -->
    <target name="testWithStyleFromDirAndXslImport">
        <mkdir dir="${outputdir}/html"/>
        <junitreport todir="${outputdir}">
            <fileset dir="${jrdir}">
                <include name="TEST-*.xml"/>
            </fileset>
            <report todir="${outputdir}/html"
                styledir="junitreport-with-include"
                format="frames"/>
        </junitreport>
    </target>

    <target name="testWithParams">
        <mkdir dir="${outputdir}/html"/>
        <junitreport todir="${outputdir}">
            <fileset dir="${jrdir}">
                <include name="TEST-*.xml"/>
            </fileset>
            <report todir="${outputdir}/html"
                styledir="junitreport"
                format="frames">
                <param name="key1" expression="value1"/>
                <param name="key2" expression="value2"/>
            </report>
        </junitreport>
        <concat>
            <fileset file="${outputdir}/html/index.html"/>
        </concat>        
    </target>

</project>
        

Other Ant examples (source code examples)

Here is a short list of links related to this Ant junitreport.xml source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.